Repository navigation
(ui) - Halve the cost of panning the trace - #4
Merged
Merged
Conversation
Plotly restyled all of the invisible Basecall hover markers on every redraw, twice per pan, which was the largest part of the pan cost. Setting marker.maxdisplayed makes Plotly draw only the markers inside the axis ranges. With one per basecall it never thins out the ones in view, so they keep their 16 px hover target and every tooltip stays where it was. Coding assisted with Claude Opus 5.5
Every pan re-sent all arrow shape paths with the xaxis3 sync, and any shape-array edit makes Plotly replot the whole figure instead of only updating the axis range. A pan moves the bases in view by a base or so, which changes the fixed-size arrow heads by well under a pixel. The paths are now sent only once bases-per-pixel has moved more than 5% from the zoom the arrows were last drawn at. Panning keeps the cheap range-only relayout, and zooming still redraws the heads at their full size. Coding assisted with Claude Opus 5.5
Skitionek
marked this pull request as ready for review
October 23, 2026 14:43
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
Panning with annotations loaded now costs about 33 ms of main-thread time instead of 70 ms (18 ms instead of 31 ms without annotations), and the plot, range slider and tooltips look and behave as before. Plotly now draws only the invisible Basecall hover markers that are in view, and the arrow shape paths are re-sent only when the zoom moves more than 5%.
Why
Each pan restyled all 1,453 hover markers twice, and re-sending the arrow paths made Plotly replot the whole figure instead of only moving the axis. Together they were more than half the pan cost.
Decision
WebGL (
scattergl) peaks were tried first and dropped: they save about 10 ms per pan, but Plotly's range slider draws only SVG traces, so the overview went blank.maxdisplayed: 1ormode: 'none'were as fast as the cap used here but lose the Basecall tooltip near the plot's bottom edge, because Plotly sets a marker's hover radius only when it draws it.Not in this PR
Coding assisted with Claude Opus 5.5