Skip to content

Minimize text rendering allocations#57

Merged
treeform merged 2 commits into
masterfrom
minimize-allocations
Jun 28, 2026
Merged

Minimize text rendering allocations#57
treeform merged 2 commits into
masterfrom
minimize-allocations

Conversation

@treeform

Copy link
Copy Markdown
Owner

Summary

  • Decode text as UTF-8 directly instead of materializing rune strings.
  • Add runtime Rune glyph lookup and packed kerning caches rebuilt from atlas data.
  • Use the allocation-free lookup path in drawText and getTextSize.

Profile

Basic Window, 300 frames:

  • Before: text rendering was about 15.4k allocations per steady frame.
  • After: drawText and getTextSize are 0 allocations per steady frame.
  • Frame steady average dropped from about 0.326 ms to about 0.084 ms.

@treeform treeform merged commit bc7ce04 into master Jun 28, 2026
7 checks 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