perf: hand glyphon the text areas as an iterator, not a Vec - #26
Merged
Conversation
prepare() takes impl IntoIterator<Item = TextArea>, but the chained iterator was collected into a Vec first: 7,661 areas of about 64 bytes on a full screen, allocated and dropped every frame. --bench, three runs each side: prepare 0.54-0.56ms -> 0.45-0.48ms at 1280x800, and 1.19-1.23ms -> 1.02-1.05ms at 1920x1200. 13-16% off. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GvMacYD6T9EoWqc7C247Hr
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.
preparetakesimpl IntoIterator<Item = TextArea>, but the chained iterator was being collected into aVecfirst: 7,661 areas of ~64 bytes on a full screen, so about 0.5 MB allocated and dropped every frame. Passing the iterator straight through is a one-line change.--bench, three runs each side:13–16% off
prepare. This is the follow-up to #25's finding that one area per cell is the right shape after all — so the remaining win was in how those areas are handed over, not in how many there are.Documented in
docs/performance.md7.14 and in the techniques catalogue.Test
cargo test— 202 pass.cargo clippy --all-targets -- -D warningsandcargo fmt --check— clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01GvMacYD6T9EoWqc7C247Hr