Repository navigation
perf: Only track ready state for node views with a figure - #104
Merged
Merged
Conversation
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.
1 of 3 tasks
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.
Description
Every embedded node view polled
has_finished()on its own 25 ms timer until it finished rendering, and each layout pass ran areadyViewMapstate 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;
hydratedNodesdeliberately 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