Repository navigation
Compare column.frozen against false first - #4273
Merged
Merged
Conversation
Most columns aren't frozen, and start-frozen columns are more common than end-frozen ones, so check `false` first, then `'start'`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
nstepien
marked this pull request as ready for review
November 1, 2026 01:04
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4273 +/- ##
=======================================
Coverage 99.27% 99.27%
=======================================
Files 44 44
Lines 2204 2208 +4
Branches 964 965 +1
=======================================
+ Hits 2188 2192 +4
Misses 16 16
🚀 New features to boost your workflow:
|
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.
Most columns aren't frozen, and start-frozen columns are more common than end-frozen ones, so every check of
column.frozennow compares againstfalsefirst, then against'start'.Changes
getCellStyle,getCellClassname,getColSpan,collectColumns, and the column sort checkfalsefirst, then'start'.useViewportColumnsand the drag handle compare againstfalseinstead of checking truthiness.AGENTS.mdlists the rule under its conventions.The normalization of
rawColumn.frozeninuseCalculatedColumnsstays as it is, sinceundefinedis the most common value there.Rendered markup doesn't change:
renderToStringoutput is byte-identical for grids with unfrozen, start-frozen, and end-frozen columns, with and withoutcolSpan.Performance
The functions are faster, but whole renders don't change measurably. The change saves about 3 ns per cell, or 1.5 µs for an update of 600 cells, and all the code it touches is 0.2–0.5% of the CPU time of a mount or a scroll.
Measured on the
vp packoutput with React's production build, on Windows, for 40 columns with 1 start-frozen column. Every measurement ran in a fresh process or page, with the order of the builds rotating between rounds: 10 rounds in Node, 8 in Chromium, 6 in Firefox, and 4 in WebKit. Differences are medians of the per-round differences, and a byte-identical copy of the build usually stayed within ±2%. These runs predate #4258, but this PR's built diff is identical to the measured one.Time per call, in hot loops:
getCellStylegetCellClassnameIn Node,
getColSpanwent from 3.68 to 2.76 ns (−25%), sorting 40 columns from 346 to 304 ns (−12%), anduseCalculatedColumnsfrom 3.57 to 3.48 µs (−2.5%).Mean render and commit time per update, in ms, without browser layout, for 10,000 rows:
columnsarrayIn Node,
renderToStringof 100 rows took 5.37 ms before and 5.40 ms after (+1.2%), also within noise.There's one exception. In WebKit on Windows, a new
columnsarray renders about 0.03 ms slower with these columns: +6.3%, +4.1%, and +3.9% in three separate runs of 4, 12, and 15 rounds. With 2 start-frozen and 2 end-frozen columns, it's 1–5% faster instead. ThegetCellStyleandgetCellClassnamechanges each reproduce the slowdown, and a build with only the other changes doesn't. The cause is unknown: it's about 50 ns per cell, more than those two functions cost in total, so it's an indirect effect. It only applies whencolumnschanges, and Safari wasn't tested.vp run cipasses.🤖 Generated with Claude Code