Repository navigation
perf(gui): cut per-frame allocs in scrollbars, Text a11y and showcase catalog - #992
Merged
Merged
Conversation
… catalog - Stock scrollbar is one scrollbarView that builds its bar and thumb shapes directly; its handlers are shared funcs reading the settings through eventHandlers.scrollbar. 7 allocs per bar per frame -> 1, so every scrollable container saves 12. Hook (Thumb/Track) bars unchanged. eventHandlers moved to shape_events.go to keep shape.go under the 800-line gate. - Text keeps its accessInfo on the textView, as it does tc and anim: one fewer alloc per Text per frame. a11yInfoProse removed. - Showcase catalog sidebar is a VirtualList: only visible rows are built (about 240 fewer allocs per frame on every page). Tests: alloc tests for the scrollbar and Text, stock-scrollbar behaviour test, scroll_column goldens recorded on the old code and matching. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks done
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
Three allocation cuts, found by profiling real frames.
ScrollbarCfg. NowscrollbarViewbuilds both shapes directly, and its handlers are shared funcs that read the settings through a neweventHandlers.scrollbarfield. Every scrolling widget saves 12 allocs per frame (Combobox open 30→18, CommandPalette 42→30, ListBox virtualized 107→95, VirtualList 70→58). Bars with aThumb/Trackhook are unchanged.eventHandlersmoved togui/shape_events.gounchanged, becauseshape.gosat at the 800-line gate.accessInfolives on thetextView, astcandanimalready do.a11yInfoProseis removed.VirtualList. Only the visible rows are built: about 240 fewer allocs (−33%) and about 30% less frame time on every showcase page.Tests
TestScrollbarStockAllocs(failed with 7 before the change) andTestTextA11YInfoNoAlloc.TestScrollbarStockBehaviour: thumb placement, hover, drag and gutter press. It passes before and after.scroll_columnandscroll_column_hover, recorded on the old code; the new code matches them byte for byte.TestCatalogBuildsOnlyVisibleRows(failed with 78/78 before) andTestCatalogRowClickSelects.make prepushis green.🤖 Generated with Claude Code