perf(common): improve Select All row selections toggling on large dataset by 9x faster - #2785
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2785 +/- ##
=======================================
Coverage 100.0% 100.0%
=======================================
Files 199 199
Lines 25814 25867 +53
Branches 9144 9176 +32
=======================================
+ Hits 25814 25867 +53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
angular-slickgrid
aurelia-slickgrid
slickgrid-react
slickgrid-vue
@slickgrid-universal/angular-row-detail-plugin
@slickgrid-universal/aurelia-row-detail-plugin
@slickgrid-universal/react-row-detail-plugin
@slickgrid-universal/vue-row-detail-plugin
@slickgrid-universal/binding
@slickgrid-universal/common
@slickgrid-universal/composite-editor-component
@slickgrid-universal/custom-footer-component
@slickgrid-universal/custom-tooltip-plugin
@slickgrid-universal/empty-warning-component
@slickgrid-universal/event-pub-sub
@slickgrid-universal/excel-export
@slickgrid-universal/graphql
@slickgrid-universal/odata
@slickgrid-universal/pagination-component
@slickgrid-universal/pdf-export
@slickgrid-universal/row-detail-view-plugin
@slickgrid-universal/rxjs-observable
@slickgrid-universal/sql
@slickgrid-universal/text-export
@slickgrid-universal/utils
@slickgrid-universal/vanilla-bundle
@slickgrid-universal/vanilla-force-bundle
@slickgrid-universal/web-mcp
commit: |
5 tasks
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.
Summary
Improve checkbox Select All performance for large local datasets while preserving normal row-selection behavior and paginated all-pages selection state.
In the 500K-row benchmark, Select All is approximately 9× faster than
master. The final implementation keeps compact range handling private toSlickGrid, avoids duplicate DataView/grid selection work, and includes regression fixes found through Cypress and unit coverage.Why
SlickGrid virtualizes DOM rendering, so the 500K-row cost was primarily main-thread selection bookkeeping rather than DOM creation.
On
master, the expensive work included:SlickRangeper selected row;The checkbox Select All path already produces ascending, unique row indexes, which makes it safe to compact contiguous rows into a small number of ranges.
Changes
Compact ascending contiguous rows into
SlickRangeinstances only for checkboxclick.selectAll.Keep range compaction private to
SlickGrid.SlickHybridSelectionModelkeeps its existing range conversion behavior.Reduce selected-cell CSS work for non-rendered rows.
Reduce selected-row diff work for bulk selection flows.
Avoid duplicate DataView/grid selection work.
Preserve selection styling and state compatibility.
Validation
TypeScript diagnostics passed:
Prettier validation passed.
git diff --checkpassed.Focused selection suites passed:
Result: 808 tests passed.
Added regression coverage for:
Cypress regression follow-ups covered:
Browser Benchmark
Benchmarked in the Vanilla demo at:
The 500K-row dataset was loaded before clicking the checkbox Select All control. Timings were captured using
console.time()instrumentation around the selection phases.Select All: 500K Rows
mastergrid.setSelectedRows()Unselect All: 500K Rows
mastergrid.setSelectedRows()The original Vanilla benchmark reduced Select All from approximately 4 seconds to below 0.5 seconds, or roughly 9.4× faster and approximately 89% less time.
Unselect All improved from approximately 2 seconds to below 0.2 seconds, depending on the run.
Revalidated After Regression Fixes
The benchmark was repeated on a different computer using the same 500K-row workflow. The values below are averages from two page-reload runs. Raw milliseconds are hardware-specific, but the relative improvement remains consistent.
masterThe remaining Select All cost is mostly maintaining the public selected-row array and publishing the corresponding selection event for 500K rows.
Comments
The optimization is intentionally limited to the checkbox bulk Select All path.
Normal checkbox row toggles, Ctrl/keyboard selection, programmatic selection, and Hybrid Selection Model range behavior retain their existing observable behavior.
The framework Cypress updates are required because the optimized behavior lives in the common package and is shared by Angular, Aurelia, React, Vue, and Vanilla demos.
AI / LLM Assistance
Checklist