Repository navigation
perf: reuse rowspan hosts during vertical scrolling - #1349
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1349 +/- ##
=======================================
Coverage 93.41% 93.41%
=======================================
Files 34 34
Lines 13519 13524 +5
Branches 4091 4093 +2
=======================================
+ Hits 12629 12634 +5
Misses 686 686
Partials 204 204 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Avoids an includes() lookup per cached span host when gathering the rows whose cells are cleaned up and rendered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6pac-ai
left a comment
There was a problem hiding this comment.
Looks good, approving. I pushed one small follow-up, 76a58a6. It collects the rows to process in a Set, so we no longer call includes() on the array for every cached span host. Behaviour is unchanged.
Verification
- Vitest: 1572/1572 pass, and the build and
tsc --noEmitare clean. - Cypress: these specs pass, 159/159 on 21b5fbd, and 0032 again after the follow-up:
- 0031 and 0032
- colspan
- pinning-rows
- row-detail-selection-and-move
- variable-row-height-spans
- example16-row-detail
- quirk-rowspan-stacking
- The mandatory-rows unit test changed from 48 to 54 cells. I checked that the 6 extra cells are host row 2's and contain no duplicates.
Benchmark (example 0032, 80 vertical steps of 30px)
- master: 83 host rows removed and 80 re-added
- this PR: 4 removed and 1 added
- Both end with the same 44 rendered rows.
Bonus fix: after a vertical scroll followed by a horizontal scroll, master is missing cells l15–l21 on host row 8. This PR renders them.
Not caused by this PR: rows that intersect a rowspan keep the cells to the left of the horizontal range, because cleanUpCells is skipped for those rows. master does the same. It could be looked at separately.
Minor: the getEditController()?.cancelCurrentEdit() change in the spec is unrelated, but harmless.
Summary
Reduce unnecessary DOM work when scrolling grids with tall rowspans by retaining cached span hosts as covered rows enter the viewport.
Why
Previously, rendering covered rows could remove and recreate an existing rowspan host, causing avoidable DOM churn during vertical scrolling.
Changes
Validation
npm run buildpassed, including lint and type generation.git diff --checkpassed.Comments
Adapted from slickgrid-universal PR #2932. No benchmark was run for this repository.
Benchmark
In headless Chrome, an 80-step, 2,400px scroll through Slickgrid-Universal Vanilla Example 33 produced:
Three runs after the fix all had zero host removals or insertions. They averaged about 17.1 ms per animation-frame step. Frame timings were not recorded before the fix, so the benchmark does not quantify a speedup.
AI / LLM assistance
Checklist