perf(chart): skip hidden chart work and offscreen append damage - #737
Merged
Merged
Conversation
With many charts open, every chart paid for every tick: a chart in a background tab or a hidden dock still prepared frames, woke its axis observers and re-folded its whole retained volume timeframe after each candle patch, and each tick appended off screen still marked the cached bake dirty. Hidden or non-presentable charts now skip frame preparation and axis notifications, and the dock host's visibility reaches the stacks attached to it (detached windows keep their own). Revealing an Add or Custom stack restores only the tiles its virtual list shows. The volume timeframe scan is bounded to the patched suffix, an offscreen append marks damage only when new or evicted rows reach the cached cross or volume bake, and the pending append queue is bounded to its newest rows. A visible chart draws the same pixels as before. The candle tail update per tick drops from about 22 us to about 0.13 us per chart, flat across 1, 16 and 64 charts.
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.
What & why
With many charts open, every chart paid for every tick, visible or not: a chart in a background
tab or a hidden dock still prepared frames, woke its axis observers and re-folded its whole
retained volume timeframe after each candle patch, and every tick appended off screen marked the
cached bake dirty.
dock host's visibility reaches the stacks attached to it; detached windows keep their own.
volume bake span; Metal and wgpu stay conservative.
A visible chart draws the same pixels as before. In component timings the candle tail update per
tick drops from about 22 us to about 0.13 us per chart, flat across 1, 16 and 64 charts.
How to verify
cargo test -p moon-ui-gpui --bin moonterminal chart(chartdx, chart_tabs, panels::chart)cargo test -p moon-ui-gpui --test theme_contractdetach a chart; each chart shows current prices right after it becomes visible again.