Repository navigation
perf(adapters): resolve linked-hover bins from the edge triples by arithmetic - #119
Merged
Merged
Conversation
This was referenced Sep 28, 2026
jvdd
force-pushed
the
perf/hover-bin-arithmetic
branch
from
September 29, 2026 08:31
1d3aa99 to
8df5996
Compare
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.
Closes #38.
Change
[lo, step, n]edge triples per trace uid (hoverEdgesByTraceUid, renamed fromhoverCellsByTraceUidbecause it holds triples now)._hoverBoundsFromEdgesand_rebuildHoverCellsare deleted, and binned traces set nocustomdata.binAt(runtime/hover.js) finds a bin with the kernel's rule:floor((v - lo) / step + 1e-9), with the top edge closed.planHoverVisualsuses it instead of the linear scans over cells, in axis mode and in cell mode.[0, n - 1], but the server never counts a row outside the grid, and a clamp would light up an edge bin for it.pt.pointIndex([row, col]) and the triples, not frompt.x/pt.y: on a date axis Plotly reportspt.xas a date string.hoverDataValue(plotly/hover.js) converts Plotly's date string with the axis's ownd2c. Before, the string gaveNaN, so linked hover from a date axis drew no guide and no band (onmaintoo).Architecture.mdand three stale comments (runtime/cube.js,trace/hist.py,trace/hist2d.py) describe the new contract.Not changed: geo traces still build one GeoJSON rectangle per non-empty cell, because the choroplethmap needs them to draw. Geo is not a hover target (see the comment on #38).
Impact
Measured in headless Chromium, 7 fresh pages per case, median (script and raw results kept outside the repo):
A 200-bin histogram shows no meaningful change (heap 9.56 vs 9.54 MiB, hover 16.5 vs 11.5 µs).
Correctness:
main, 0.3 on a 0.1-wide grid lit up the lower bin, and the maximum of a histogram2d got no band.Related: #128 (the cube live brush draws temporal histogram targets in the physical unit), found in this review.
Tests
test_hover_lookup_puts_edge_values_in_the_server_bin(a histogram and a histogram2d target): the expected bin comes from the server's own counts. Fails onmain.test_temporal_histogram2d_source_hover_links_the_cell: a real mouse hover on a date-axis histogram2d source links the right cell. It fails if the source bounds come frompt.x.test_mouse_hover_on_a_date_axis_links_guide_and_band: a real mouse hover on a date-axis line source; the guide and the band land on pixels from an independent UTC conversion of the hovered date. Fails before thehoverDataValuefix (no guide, no band).TestBinEdgeTripleBrowsernow checks that the edges map holds the triples and that binned traces have nocustomdata. The histogram2d test uses a real mouse hover.pytest tests flexviz_polars/tests: 2427 passed, 2 skipped.pytest -m browser tests: 344 passed, 16 skipped.