Skip to content

perf: Only track ready state for node views with a figure - #104

Merged
philippjfr merged 1 commit into
mainfrom
perf/ready-state-polling
Dec 4, 2026
Merged

philippjfr merged 1 commit into
mainfrom
perf/ready-state-polling

Conversation

@philippjfr

@philippjfr philippjfr commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

Every embedded node view polled has_finished() on its own 25 ms timer until it finished rendering, and each layout pass ran a readyViewMap state update per view. Views that finish asynchronously, such as panel-material-ui widgets, kept polling while a large graph mounted: a 1000-node graph with a small card per node fired about 10,000 timers during the initial render.

The ready state is only used to restyle a Bokeh figure once it has rendered; hydratedNodes deliberately does not depend on it. I now track only views that contain a figure, and each pass makes a single batched state update and schedules one shared retry timer instead of one per view. On the same 1000-node graph the timer count drops from 10,186 to 42. The direct CPU saving is modest (around 100 ms of main-thread work), but it removes thousands of React state updates while the graph mounts.

I added a UI test that mounts 60 nodes with panel-material-ui buttons and asserts that no 25 ms ready-state timers are scheduled. It fails on main and passes here. The existing figure styling test and the full unit and UI suites pass.

AI Disclosure

  • Tool & Model: Claude Code + Claude Opus 5.5

  • Usage: Profiled a large-graph demo in Chromium, identified the polling, wrote the change and the test.

  • I have tested all AI-generated content in my PR.

  • I take responsibility for all AI-generated content in my PR.

Checklist

  • Tests added and are passing

Every node view polled has_finished() on its own 25 ms timer and pushed a
readyViewMap update on each layout pass. The ready state only restyles
Bokeh figures, so only views containing one are tracked now, with one
batched state update and one shared retry timer.
@philippjfr
philippjfr merged commit cac2e8d into main Dec 4, 2026
17 checks passed
@philippjfr
philippjfr deleted the perf/ready-state-polling branch December 4, 2026 13:48
@philippjfr philippjfr mentioned this pull request Dec 4, 2026
1 of 3 tasks
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