Skip to content

perf(chart): skip hidden chart work and offscreen append damage - #737

Merged
kirillDevPro merged 1 commit into
mainfrom
perf/chart-hidden-work
Sep 26, 2026
Merged

kirillDevPro merged 1 commit into
mainfrom
perf/chart-hidden-work

Conversation

@kirillDevPro

Copy link
Copy Markdown
Collaborator

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.

  • Hidden or non-presentable charts skip frame preparation and axis notifications. The Charts
    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, not every child.
  • The volume timeframe scan after a candle patch is bounded to the patched suffix.
  • An offscreen append marks damage only when new or evicted rows reach the cached cross or
    volume bake span; Metal and wgpu stay conservative.
  • The pending append queue is bounded and keeps its newest rows.

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_contract
  • Checked on a debug build: switch chart tabs back and forth, hide and re-show the Charts dock,
    detach a chart; each chart shows current prices right after it becomes visible again.

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.
@kirillDevPro
kirillDevPro merged commit b84559c into main Sep 26, 2026
8 checks passed
@kirillDevPro
kirillDevPro deleted the perf/chart-hidden-work branch September 26, 2026 15:31
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