Repository navigation
perf: shrink the document every session builds on the event loop - #93
Merged
Merged
Conversation
Each session builds, validates, serialises and sends its Bokeh document on the loop that serves every other session and /liveness. - Draw shank outlines, bank lines and labels with one renderer per style. A 4-shank document drops from 33 renderers and 485 models to 9 and 269. - Limit tap and box-select tools to the electrode and survey-bar renderers, so a tap on a shared outline renderer can't dim the other outlines. - Send numeric electrode columns as arrays, compute their geometry with NumPy, and skip Bokeh's per-cell check of that fixed-shape source. - Reuse the cached data URI for tool icons instead of re-encoding six PNGs. Assisted-by: ClaudeCode:claude-opus-5-5
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #93 +/- ##
======================================
Coverage ? 85.58%
======================================
Files ? 21
Lines ? 3421
Branches ? 0
======================================
Hits ? 2928
Misses ? 493
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Nov 16, 2026
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.
🤖 AI text below 🤖
Shortens the event-loop stall that every new session causes. This is the per-session stall noted as not fixed in #92.
Summary
Bokeh builds, validates, serialises and sends each session's document on the loop that also serves other sessions and
/liveness. That cost scales with the number of models and the size of their data, and outline decoration made up most of the models.Evidence
Real images, 4500M memory cap, headless browser loading sessions while polling
/liveness. The first session of each run is excluded. Each page uses an empty browser cache./livenessper sessiondevmedian (max)Median page-ready time went from 1.73 s to 1.32 s at 8 CPUs, and from 5.05 s to 3.18 s at 0.25 CPU.
Same behaviour:
devon all four probe types, with nothing selected.devand this PR in a browser, the plot canvas is pixel-identical after an outline tap, electrode tap, box select, probe switch and a tap on the new probe. No page errors.ruff check .is clean.Not fixed: sessions are still built on the event loop, so this makes the stall shorter but doesn't remove it. A heavily contended server can still trigger the watchdog. The first session's extra cost is handled separately by #92, and each run here logged one stall warning at 0.25 CPU, the same count on
devand this PR. I didn't identify which session caused it.Merge Danger
Door: two-way
Revert the commit. No data or format changes.
Blast Radius: plot
Every probe plot changes how it's built, and the browser now receives typed arrays for numeric electrode columns. Survey loading is covered by the test suite but wasn't part of the browser comparison.
Assisted-by: ClaudeCode:claude-opus-5-5