Reduce ASCII text render allocations#56
Closed
relh wants to merge 1 commit into
Closed
Conversation
Owner
|
I like your PR here, but I fixed it in a more general way in this PR: #57 Instead of June, just ASCII, I did it for all Unicode characters. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
drawText/getTextSizecalls through byte iteration while preserving the existing Unicode fallback pathWhy this belongs in Silky
The hot allocations come from Silky's normal text APIs:
toRunes, per-glyph$runestrings, and string-keyed kerning lookups on every ASCII label. Coworld hits this through regulartext,button,checkBox,drawText, andgetTextSizecalls, so the fix is inside the UI library rather than Coworld glue.This replaces closed #55 with a clean branch off upstream
master. The important v2 difference is that the ASCII tables are explicitly runtime-only and are rebuilt after atlas load/build; the PR does not serialize derived cache data into atlas metadata.Downstream proof
Coworld follow-up PR: https://github.com/Metta-AI/coworld-vanilla-wow/pull/453
90-frame replay command, from Coworld
player/:Last 30
render frameevents:Interpretation: upstream Silky confirms the text allocation regression is real; this cleaned Silky v2 recovers the allocation win without the bad #55 branch shape.
Verification
nim check --path:src src/silky/atlas.nimnim check --path:src src/silky/contexts.nimnim check --path:src src/silky/semantic.nimnim r --hints:off --warnings:off --path:src --eval:...assertion thatasciiEntries,asciiKerning, andasciiFallbackare absent fromSilkyAtlas.toJson()nim check global_viewer.nimnim check player.nim