Skip to content

perf(Table): pinned offsets are computed once per column list, not once per cell - #11893

Merged
cixzhang merged 4 commits into
mainfrom
l0/table-pinned-offsets-once
Nov 21, 2026
Merged

cixzhang merged 4 commits into
mainfrom
l0/table-pinned-offsets-once

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

User impact

  • Who: people using a Table with pinned columns (useTableStickyColumns), especially wide tables that window their columns, such as a 1,000-column report.
  • Before: for every header and body cell it transformed, the sticky-columns plugin resolved every column's width again to find the pinned offsets. At 1,000 columns, that cost about 0.8 ms in each horizontal scroll step that brings a column in (real-Chrome profiling build).
  • After: a render computes the pinned offsets once for its column list, and each cell reads them. Offsets, pinning and dividers are unchanged.

What changed

  • useTableStickyColumns.tsx: resolveStickySide reads precomputed start and end offsets. A memoized reader recomputes them only when the column list or the pinned keys change.
  • [perf] changeset.

Evidence

Host Range p95, main Range p95, all four No-op p95, all four
First farm host 6.49–6.67 ms 3.43–3.50 ms 0.62–0.68 ms
Second farm host (about 18% slower) 7.59–8.03 ms 3.60–4.14 ms 0.72–0.99 ms
Release check's runner (4-core-ubuntu, timing gate on) — range-plus-commit p95 3.5 ms 0.1 ms

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 preflight at 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

  • One plugin file and its test; no API or record change.
  • Public text contains no internal context.

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.

…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.
@vercel

vercel Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 21, 2026 1:18am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 15, 2026
@astracat-bot

astracat-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 21, 2026, 1:49 AM UTC

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 416eec2

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 03c5dd1

Storybook · Sandbox · built from this PR's head

Modified components

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.

Component · story Before After Diff
Table · Default (neutral, dark) · inheritance unknown: not found in the 7 newest reports of other pull requests before frame after frame diff frame
Table · Default (neutral, light) · inheritance unknown: not found in the 7 newest reports of other pull requests before frame after frame diff frame

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

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the code change is correct, and two small text fixes remain.

  • The changeset .changeset/table-pinned-offsets-once.md starts 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:pages run 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 resolveStickySide computed 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).
  • resolveStickySide reads 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.

Automated review (maintainer link)

Comment thread .changeset/table-pinned-offsets-once.md Resolved
The changeset is a performance change, so it opens [perf]. Comments name
what the precomputed offsets do in shorter sentences.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 9f0ad3a

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:pages run 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 resolveStickySide computed 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).
  • resolveStickySide reads 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.

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 resolveStickySide computed 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).
  • resolveStickySide reads 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.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec a175453

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :725 and :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).
  • resolveStickySide reads 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 main without 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 main the 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 main too: 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.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 20, 2026 12:01
@cixzhang
cixzhang marked this pull request as draft November 21, 2026 01:04
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 03c5dd1

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :725 and :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).
  • resolveStickySide reads 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 main too: 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.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 21, 2026 01:30
github-actions Bot added a commit that referenced this pull request Nov 21, 2026
@cixzhang
cixzhang merged commit 9a11c3c into main Nov 21, 2026
151 checks passed
@github-actions
github-actions Bot deleted the l0/table-pinned-offsets-once branch November 21, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 03c5dd1b Deployed Nov 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant