Repository navigation
perf(Table): pinned offsets are computed once per column list, not once per cell - #11893
Conversation
…ce per cell The sticky-columns plugin resolved every column's width again for each header and body cell it transformed. A render now computes the pinned offsets once for its column list and each cell reads them.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 416eec2 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Table | 123.9 kB (0) · 21.1 kB CSS (0) | — | ✗ · ✓ · — |
| TableBody | 6.6 kB (0) · 3.3 kB CSS (0) | — | ✗ · ✓ · ✗ |
| TableCell | 106.1 kB (0) · 20.1 kB CSS (0) | — | ✗ · ✓ · ✓ |
5 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TableFooter | 3.5 kB (0) · 3.3 kB CSS (0) | — | ✗ · ✓ · ✗ |
| TableHeader | 3.5 kB (0) · 3.3 kB CSS (0) | — | ✗ · ✓ · ✗ |
| TableHeaderCell | 105.9 kB (0) · 20.0 kB CSS (0) | — | ✗ · ✓ · ✓ |
| TableRow | 7.2 kB (0) · 4.1 kB CSS (0) | — | ✗ · ✓ · ✗ |
| TableSelectionToolbar | 77.9 kB (0) · 14.5 kB CSS (0) | — | ✗ · ✓ · ✓ |
Visual changes: 2 snapshots in 1 component
A change is a question for the reviewer, not a failure.
Inheritance checked against the 7 newest reports of other pull requests.
Package size: @astryxdesign/core 7.87 MB packed (+428 B); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: the code change is correct, and two small text fixes remain.
- The changeset
.changeset/table-pinned-offsets-once.mdstarts with[fix], which lists this behavior-preserving speedup under Fixes in the changelog; start it with[perf], the Performance category, instead. - The description needs the first-load gzip delta for a page that renders Table without sticky columns, which the import-boundaries rule for optional features (INV10) asks of a change that grows one; a
pnpm size:pagesrun from the merge base measures +0 B on the table page, so one line closes it.
The earlier inline suggestions on comment wording and the stale resolveStickySide doc comment still apply and are optional.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (1): Whatever the scope, these are computed over the whole pull request
- Whatever the scope, these are computed over the whole pull request: checked: the three changed files, the description and the earlier review, no finding.
- Changeset: a render computes the pinned offsets once instead of once per cell, so wide tables render faster: verified (one width pass per render at the head); its
[fix]category: false, see above. - Before: the plugin resolved every column's width for each header and body cell: verified (the base
resolveStickySidecomputed both offset maps per call). - About 0.8 ms per scroll step at 1,000 columns: consistent, not reproduced in a browser (the same width pass takes about 1.1 ms for 21 cells in jsdom).
- After: one computation per column list, which each cell reads: verified (one pass on a first render, none on a re-render with the same columns).
- Offsets, pinning and dividers unchanged: verified (17 sticky-columns tests pass; divider code untouched).
resolveStickySidereads precomputed offsets, and the reader recomputes only when the columns or the pinned keys change: verified (useTableStickyColumns.tsx:200-242,:706-709).- Red first, 84 calls for twenty rows against 12 for two on main and equal here: verified (fails on the base with "expected 84 to be 12", passes at the head).
- Table suites pass (47 files, 891 tests), and tsc and eslint are clean: verified.
- No timing claim against the column-windowing budget: verified.
- One plugin file and its test, with no API or record change: verified (plus the changeset; the built API surfaces are identical).
- Public text contains no internal context: verified.
- Overlap with #11844 and #10943: verified (neither changes how offsets are computed).
.changeset/table-pinned-offsets-once.md: finding (category).packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx: clear (optional comment suggestions).packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsx: clear.
The changeset is a performance change, so it opens [perf]. Comments name what the precomputed offsets do in shorter sentences.
|
/approve-spec 9f0ad3a |
There was a problem hiding this comment.
Changes requested: the code is correct and its tests pass; two description lines remain.
- The description's What changed list says "
[fix]changeset", but the changeset opens[perf]; update that line to match. - The description needs the first-load gzip delta for a page that renders Table without sticky columns, which the import-boundaries rule for optional features (INV10) asks of a change that grows one; a
pnpm size:pagesrun from the merge base measures +0 B on every reference page, so one line closes it.
The spec approval on this head does not cover these two points, since the pull request changes no record.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (0): none
- Title, offsets computed once per column list instead of once per cell: verified (the offsets reader in
useTableStickyColumns.tsx:223-242; one width pass per render at any row count). - Changeset, a performance entry: a render computes the pinned offsets once instead of once per cell, so wide tables render faster: verified (the Performance category; the plugin's work no longer grows with rows).
- Who, tables with pinned columns, most of all wide windowed ones: verified (only the sticky-columns plugin changes).
- Before, the plugin resolved every column's width for each header and body cell: verified (the base's
resolveStickySidecomputed both offset maps per call). - About 0.8 ms per scroll step at 1,000 columns: not reproduced in a browser; consistent with the per-cell work removed.
- After, one computation per column list that each cell reads, with offsets, pinning and dividers unchanged: verified (all 891 Table tests pass; divider code untouched).
resolveStickySidereads precomputed offsets and the reader recomputes only when the columns or the pinned keys change: verified (useTableStickyColumns.tsx:200-242,:705-708).- The changeset is listed as a fix: false, it opens
[perf](see above). - Red first, 84 width passes for twenty rows against 12 for two before the change and equal counts after: verified (fails on the base with "expected 84 to be 12", passes here).
- Table suites pass (47 files, 891 tests), and typecheck and lint are clean: verified.
- No claim on the column-windowing timing budget by this change alone, with combined timing reported for four pull requests: verified that no such claim is made; the combined numbers were not reproduced.
- One plugin file and its test, with no API or record change: verified (plus the changeset; the built public surfaces are identical).
- Public text contains no internal context: verified.
- Overlap with #11844 and #10943: verified, neither changes how pinned offsets are computed.
.changeset/table-pinned-offsets-once.md: clear.packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx: clear.packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsx: clear.
There was a problem hiding this comment.
Approved pending CI: this pull request is a draft, so CI has not run on this head yet; marking it ready for review starts it.
The pinned-offsets reader, its count test and the [perf] changeset are correct, and the description matches them; there is nothing to change.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (0): none
- Title, offsets computed once per column list instead of once per cell: verified (the offsets reader in
useTableStickyColumns.tsx:223-242; one width pass per render at any row count). - Changeset, a performance entry: a render computes the pinned offsets once instead of once per cell, so wide tables render faster: verified (Performance category; the plugin's width work no longer grows with rows; the changeset check passes).
- Who, tables with pinned columns, most of all wide windowed ones: verified (only the sticky-columns plugin changes).
- Before, the plugin resolved every column's width for each header and body cell: verified (the base's
resolveStickySidecomputed both offset maps per call). - About 0.8 ms per scroll step at 1,000 columns: not reproduced in a browser; consistent in magnitude (one 1,000-column width resolution costs about 63 µs in Node, and the base ran one per transformed cell).
- After, one computation per column list that each cell reads, with offsets, pinning and dividers unchanged: verified (all 891 Table tests pass; divider code untouched).
resolveStickySidereads precomputed offsets and the reader recomputes only when the columns or the pinned keys change: verified (useTableStickyColumns.tsx:200-242,:705-708).- The changeset is listed as
[perf]: verified (.changeset/table-pinned-offsets-once.md:5). - Red first, 84 width passes for twenty rows against 12 for two before the change and equal counts after: verified (fails on the base with "expected 84 to be 12", passes here).
- First-load size from the merge base, +0 B gzip on every reference page, the table page rendering Table without sticky columns: verified (the same measurement of both builds gives +0 on all four pages).
- Table suites pass (47 files, 891 tests), and typecheck and lint are clean: verified.
- No claim on the column-windowing timing budget by this change alone: verified that no such claim is made; the other three timing pull requests are still open.
- Combined timing for four pull requests together: not reproduced; this pull request claims nothing from it.
- One plugin file and its test, with no API or record change: verified (plus the changeset; the built public surfaces are identical).
- Public text contains no internal context: verified.
- Overlap with #11844 and #10943: verified, neither changes how pinned offsets are computed.
.changeset/table-pinned-offsets-once.md: clear.packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx: clear.packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsx: clear.
|
/approve-spec a175453 |
There was a problem hiding this comment.
Approved pending CI: every CI job on this head has passed except the final aggregate test check, which is still running.
The pinned-offsets reader, its count test and the [perf] changeset are correct and match the description; there is nothing to change.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (0): none
- Title, offsets computed once per column list instead of once per cell: verified (the offsets reader in
useTableStickyColumns.tsx:224-243, read at:725and:765). - Changeset, a performance entry saying a render computes the pinned offsets once instead of once per cell, so wide tables render faster: verified (
.changeset/table-pinned-offsets-once.md:5, Performance category). - Who, tables with pinned columns, most of all wide windowed ones: verified (only the sticky-columns plugin changes).
- Before, the plugin resolved every column's width for each header and body cell: verified (before this change each cell rebuilt both offset maps, each resolving every column's floor; 84 resolutions for twenty rows).
- About 0.8 ms per scroll step at 1,000 columns: not reproduced in a browser; consistent in magnitude with one full width resolution per transformed cell before the change.
- After, one computation per column list that each cell reads, with offsets, pinning and dividers unchanged: verified (the 16 existing sticky-columns tests pass; divider code is untouched).
resolveStickySidereads precomputed offsets, and the reader recomputes only when the columns or the pinned keys change: verified (useTableStickyColumns.tsx:196-243,:706-709).- Red first, 84 width resolutions for twenty rows against 12 for two before the change and equal counts after: verified (the test fails on
mainwithout this change with "expected 84 to be 12" and passes here). - First-load size, +0 B gzip on every reference page, the table page rendering Table without sticky columns: verified (measured before and after: +0 B on all four pages).
- Table suites pass, and typecheck and lint are clean: verified (after the merge of
mainthe suite is 50 files and 936 tests, all passing; CI typecheck and lint pass on this head). - No claim on the column-windowing timing budget by this change alone: verified that none is made.
- Combined timing of four pull requests on two hosts and the release check's runner, the last of them to land taking the budget: not reproduced; it describes the four together, not this change alone.
- Preflight on this head passes build, typecheck, lint, UI tests, knowledge and changesets, with node tests failing only in real-browser cases that fail on
maintoo: consistent with CI on this head (build, typecheck, lint with its knowledge and changeset checks, and every UI and node test shard pass; the named real-browser failures do not occur in CI). - One plugin file and its test, with no API or record change: verified (plus the changeset; the generated API report lists no change for any package).
- Public text contains no internal context: verified.
- Overlap with #11844 and #10943: verified; neither changes how pinned offsets are computed.
.changeset/table-pinned-offsets-once.md: clear.packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx: clear.packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsx: clear.
|
/approve-spec 03c5dd1 |
There was a problem hiding this comment.
Approved pending CI: CI is running on this head and no check has failed so far; the merge waits for the required checks to pass.
The pinned-offsets reader, its count test and the [perf] changeset are correct and match the description, and there is nothing to change.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (0): none
- Title, offsets computed once per column list instead of once per cell: verified (the offsets reader in
useTableStickyColumns.tsx:224-243, read at:725and:765). - Changeset, a performance entry saying a render computes the pinned offsets once instead of once per cell, so wide tables render faster: verified (
.changeset/table-pinned-offsets-once.md:5, Performance category). - Who, tables with pinned columns, most of all wide windowed ones: verified (only the sticky-columns plugin changes).
- Before, the plugin resolved every column's width again for each header and body cell: verified (on the base, 12 width resolutions for two rows, 84 for twenty and 404 for a hundred).
- About 0.8 ms per scroll step at 1,000 columns: not reproduced in a browser; consistent in magnitude with one full width resolution per transformed cell before the change.
- After, one computation per column list that each cell reads, with offsets, pinning and dividers unchanged: verified (the 16 existing sticky-columns tests pass on the base and here; the divider code is untouched).
resolveStickySidereads precomputed offsets, and a memoized reader recomputes only when the column list or the pinned keys change: verified (useTableStickyColumns.tsx:196-243,:706-709).- A
[perf]changeset: verified. - Red first, 84 width resolutions for twenty rows against 12 for two before the change and equal counts after: verified (the new test fails on the base with "expected 84 to be 12" and passes here).
- First-load size, +0 B gzip on every reference page, the table page rendering Table without sticky columns: verified (measured on this head against the base: +0 B on docs, form, menu and table).
- Table suites pass, and typecheck and lint are clean: verified on this head (the Table suite is now 50 files and 936 tests, all passing; Core's typecheck and lint pass, and CI's typecheck and lint jobs pass on this head).
- No claim on the column-windowing timing budget by this change alone: verified that none is made.
- Combined timing of four pull requests on two hosts and the release check's runner, the last of them to land taking the budget: not reproduced; it describes the four together, not this change alone.
- Preflight on an earlier head with the same patch, with node tests failing only in real-browser cases that fail on
maintoo: not rerun here; this head's patch is byte-identical to that one. - One plugin file and its test, with no API or record change: verified (plus the changeset; the API generator lists no change for any package).
- Public text contains no internal context: verified.
- Overlap with two other open pull requests: verified; one changes column windowing in another module, and the other rewrites only the comment above the plugin's config ref in the plugin file, not how pinned offsets are computed.
- Land path through this review, the spec stamp, CI and the merge queue: consistent (the spec stamp is present on this head, and CI is running).
.changeset/table-pinned-offsets-once.md: clear.packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx: clear.packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsx: clear.






User impact
useTableStickyColumns), especially wide tables that window their columns, such as a 1,000-column report.What changed
useTableStickyColumns.tsx:resolveStickySidereads precomputed start and end offsets. A memoized reader recomputes them only when the column list or the pinned keys change.[perf]changeset.Evidence
Red first:
useTableStickyColumns.test.tsx"resolves the column widths for the pinned offsets once per render, not once per cell" countsresolveColumnFloorWidthscalls. Onmain, twenty rows make 84 calls against 12 for two rows; here both make the same number.First-load size (
architecture:component-import-boundariesINV10),pnpm size:pagesfrom the merge base ca9fee5: +0 B gzip on every reference page (docs, form, menu, and table, which renders Table without sticky columns). The change only reorganizes work inside the sticky-columns plugin.The Table suites pass (47 files, 891 tests), including every pinned-offset, end-edge, row-number and key-change case. tsc and eslint are clean.
The real-Chrome timing of this change, combined with fix(Table): when only its columns window, a scroll that keeps its columns commits nothing #11844, is measured next on the same harness (
module:Table/useTableColumnsVirtualizationPR3). This pull request makes no PR3 claim.Combined timing (
module:Table/useTableColumnsVirtualizationPR3: range ≤ 4 ms, no-op ≤ 2 ms). Setup: a local production Storybook build of a 1,000-column × 20-row column-windowed story, Chrome 149 headed, 1280 × 900, 1× CPU, dev-only instrumentation off, 300 range and 120 no-op steps per run. With fix(Table): when only its columns window, a scroll that keeps its columns commits nothing #11844, perf(Table): pinned offsets are computed once per column list, not once per cell #11893, perf(Text): a truncation measurement that finds the same result sets no state #11911 and perf(Table): a default cell measures its truncation on first hover or focus #11933 together:On both farm hosts the range step costs about half of main's, with one commit per range step (main: 3). On the release check's runner, which decides PR3, the four together meet it: range-plus-commit p95 3.5 ms (≤ 4) and no-op p95 0.1 ms (≤ 2), measured with the Table release proof's own scroll-to-commit probe in one gated run. The last of the four to land claims PR3.
Preflight
pnpm preflightat a175453 (main c49f847 merged), run on a separate build machine: review:pre, build, typecheck, lint, vitest ui, knowledge and changesets PASS. vitest node failed only.github/scripts/lib/offline-media.test.mjs's real-browser cases, which fail the same way on main there (its network proxy; 24/24 without it). No other failure.Scope
Overlap checked: #11844, #10943 (#11844 changes column windowing's snapshot read in another module; #10943 is a draft that records the plugin config refs as an exception and touches the sticky plugin's ref handling, not how pinned offsets are computed)
Owner: Astryx fix-loop lane 0. Land path: CodeBunny approval of the exact head, Specs stamp, CI, then the merge queue.