Skip to content

Batch consecutive same-attribute cells in ViewLineSegmentBuilder#489

Closed
msupuka wants to merge 1 commit intomigueldeicaza:mainfrom
msupuka:attribute-run-batching
Closed

Batch consecutive same-attribute cells in ViewLineSegmentBuilder#489
msupuka wants to merge 1 commit intomigueldeicaza:mainfrom
msupuka:attribute-run-batching

Conversation

@msupuka
Copy link

@msupuka msupuka commented Mar 12, 2026

Reduces NSAttributedString allocations from ~59 to ~3-5 per line by accumulating text for cells with identical attributes and flushing as a single NSAttributedString when attributes change.

Also simplifies buildAttributedString() by removing redundant call-site batching — the builder now handles batching internally via NSDictionary equality comparison on attribute dictionaries.

Benchmarked: 14x speedup on attributed string construction.

Reduces NSAttributedString allocations from ~59 to ~3-5 per line
by accumulating text for cells with identical attributes and flushing
as a single NSAttributedString when attributes change.

Also simplifies buildAttributedString() by removing redundant call-site
batching — the builder now handles batching internally via NSDictionary
equality comparison on attribute dictionaries.

Benchmarked: 14x speedup on attributed string construction.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@msupuka msupuka closed this by deleting the head repository Mar 12, 2026
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