Skip to content

Optimize: Cache Label text layout across frames - #177

Open
dirwin31 wants to merge 2 commits into
firestar5683:Domfrom
dirwin31:CacheLabels
Open

dirwin31 wants to merge 2 commits into
firestar5683:Domfrom
dirwin31:CacheLabels

Conversation

@dirwin31

Copy link
Copy Markdown

Description:

Label._render re-ran _update_text every frame, re-wrapping and re-measuring all text even when nothing changed. UnifiedLabel already cached this; Label didn't.

Fix:

-Skip _update_text when (text, rect.width, font_size, padding) is unchanged. Only redundant work is skipped.

  • Removed the now-resolved # TODO: cache until text changed.

Verification:

Added system/ui/widgets/tests/test_label_cache.py
system/ui/lib/tests system/ui/tests system/ui/widgets/tests - 75 passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant