chore: result grid benchmarking harness (legacy vs ResultGrid)#569
Draft
emrberk wants to merge 16 commits into
Draft
chore: result grid benchmarking harness (legacy vs ResultGrid)#569emrberk wants to merge 16 commits into
emrberk wants to merge 16 commits into
Conversation
A dev-only A/B harness to compare the legacy grid.js with the React ResultGrid under identical synthetic data. Inert unless localStorage "mock.pagination" is set. - benchmarkMock.ts: synthesizes any rows x cols result from one constant canned page served at a fixed 10ms latency (zero network), shared by both grids via paginationFn and window.__benchSeed. - index.tsx: two isMockPagination()-guarded hooks (paginationFn short-circuit and the __benchSeed seeder). - e2e/benchmark/gridBench.js: grid-agnostic in-page runner measuring input -> fully-repainted across 7 scroll/keyboard cases. - BENCHMARK.md: how to run it; BENCHMARK_RESULTS.md: latest legacy vs ResultGrid numbers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Make repetition counts explicit and comparable across both grids: - Home/End: 100 End→Home combinations (200 presses) - PageDown/PageUp: 100 down then 100 up (200 presses, within range) - Corner jumps: 100 bottom-right→top-left cycles (200 presses) Re-ran all three on both grids; updated BENCHMARK_RESULTS.md. Step counts now match between grids for every case, so totals are directly comparable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Each step now stops its timer only once the grid has settled into a
verified-correct state, not merely "a frame painted":
- every visible cell shows the value for its own (row, col),
- the rendered cells cover the viewport,
- for keyboard moves, the focused cell is at the exact expected (row, col)
with the value for that position.
To make value assertions exact and grid-agnostic, the mock now seeds
self-describing cells "r{row}c{col}" (catches blank, stale, and
column-misaligned cells in one check). Each run reports a `failures` count.
Re-ran both grids end to end (~5,600 asserted steps, 0 failures) and
refreshed BENCHMARK_RESULTS.md. The narrower self-describing columns put
more columns on screen, so column virtualization shows harder: horizontal
scroll 4.9x, Home/End 5.2x, corner jumps 1.9x, right-arrow stepping 1.8x;
vertical paging and down-arrow stepping remain tied.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The legacy grid does NOT scale proportionally — its M = yMax/h ratio is computed but never used; it advances the virtual position 1:1 and leaps to the tail when the canvas (capped at 10,000,000 px, same as the new grid) bottoms out. So both grids cap + tail-leap; the real difference is the focus coordinate space (new grid: virtual rows; legacy: absolute rows), which the harness already accounts for. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Re-ran all 7 cases on both grids (1600x900, mock.pagination) against the merged base; 0 failures across ~5,600 asserted steps. Column-bound cases (horizontal scroll, Home/End, corner jumps, right-arrow) remain markedly faster on ResultGrid. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Dev-only A/B benchmarking harness to compare the legacy
grid.jswith the new ReactResultGridunder identical synthetic data, plus the latest results. Stacked on top of #568 (base:refactor/result-grid) since it exercises the new grid.Everything is gated behind the
mock.paginationlocalStorage flag.What's in here
src/scenes/Result/benchmarkMock.tsrows × colsresult from one constant canned page at a fixed 10 ms latency (zero network). Cells are self-describing (r{row}c{col}).src/scenes/Result/index.tsx(+26)isMockPagination()-guarded hooks: apaginationFnshort-circuit and awindow.__benchSeed(rows, cols)seeder. Shared by both grids.e2e/benchmark/gridBench.jsBENCHMARK.mdBENCHMARK_RESULTS.mdThe mock is shared by both grids because both go through the same
paginationFnandgridRef.setData— no per-grid benchmarking code.How a step is measured (every step is asserted)
The metric is input → fully repainted and correct. A step's timer stops only on the frame where all hold (else it waits up to a timeout and the step is counted as a failure):
(row, col)— self-describing values catch blank, stale, and column-misaligned cells in one check;(row, col)with the value for that position.Across both grids and all 7 cases (~5,600 asserted steps): 0 failures. Every scroll/keystroke landed correctly, so the numbers are time-to-verified-repaint, not just "a frame went by."
How to reproduce
yarn start, dev server on:9999).ResultGrid→?useNewGrid=1; legacygrid.js→?useNewGrid=0.localStorage.setItem("mock.pagination", "true"), reload, then run any query once (e.g.select 1) to mount the result pane —window.__benchSeedappears.e2e/benchmark/gridBench.jsinto the DevTools console to definewindow.__gridBench.failuresis 0):Cases
vscroll_1mhscroll_10khomeend_colspagedn_10kcorners_1m_10karrow_right_1karrow_down_1kResults
1600 × 900 window, grid viewport ≈ 1510 × 340–420 px. Median ms, lower is better; 0 failures everywhere.
Takeaway: vertical paging and single-row stepping are tied. Everything that touches columns — horizontal scroll, Home/End, corner jumps, even column-by-column arrow stepping — is markedly faster on
ResultGrid, which virtualizes columns; the legacy grid renders the whole visible column band.Per-case detail
All times in ms;
fail= steps whose end-state assertion never held within the timeout.1. Randomized vertical scroll — 1,000,000 rows × 20 (100 scrolls)
grid.jsResultGrid2. Randomized horizontal scroll — 2,000 rows × 10,000 cols (100 scrolls)
grid.jsResultGrid3. Home / End across 10,000 columns — 100 End→Home combinations (200 presses)
grid.jsResultGrid4. PageDown ×100 then PageUp ×100 — 10,000 rows × 20 (200 presses)
grid.jsResultGrid5. Corner jumps — bottom-right → top-left ×100 — 1,000,000 rows × 10,000 cols (200 presses)
grid.jsResultGrid6. Right arrow through 1,000 columns — 2,000 rows × 1,000 cols (999 presses)
grid.jsResultGrid7. Down arrow through 1,000 rows — 1,000 rows × 20 (999 presses)
grid.jsResultGridBENCHMARK_RESULTS.mdcarries the same tables plus extended caveats.Caveats
🤖 Generated with Claude Code