feat(core): add optional formatted data cache for large dataset exports and rendering#2563
feat(core): add optional formatted data cache for large dataset exports and rendering#2563ghiscoding merged 19 commits intomasterfrom
Conversation
Co-authored-by: Copilot <copilot@github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2563 +/- ##
========================================
Coverage 100.0% 100.0%
========================================
Files 196 196
Lines 24994 25275 +281
Branches 8832 8925 +93
========================================
+ Hits 24994 25275 +281
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 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
commit: |
|
@zewa666 @jr01 are you guys dealing with very large dataset or always using a Backend Service like OData to avoid large local dataset? If you're always using Backend Service then I guess this PR won't change anything for you, but just curious... I know that this could help a lot for use case like @kevinburkett had in #1922 the PR does add 230 new lines of code (that is what codecov says anyway) but I think it's totally worth having it in the core (SlickDataView) and it's opt-in, so user will have to enable it themselves (mainly because that will consume memory and takes time to populate the cache but doesn't impact UI responsiveness, that was an important condition: build the cache without impacting UI responsiveness). On the Example02 with 8 columns and 50K rows, it takes 23sec to run the cache. I even tried with 500K in Example 03 and it takes a lot longer to build the cache but once it's available then the export no longer freezes the browser I basically thought of doing this caching to decrease export time, and this can always be used to improve rendering time as well for large and very large dataset (build the cache and use it whenever possible). For export services, that is definitely a huge gain in perf (in other words a big drop in time it takes to export but only after the cache is ready, no need to reparse formatters every time). Why would we have very large dataset? I guess Grouping or Tree Data could be a factor (since those don't work with Backend Services) |
|
we're strictly with paginated views (20-50) eith backend datasets. but the treeview still gets quite crowded as that one is an exception |
|
yeah I guess that will be nice for only a limited subset of users, but still great to add in the core nonetheless, at least I would think so :) |
full implementation vibe coded with Copilot and Claude Sonnet 4.6
Summary
This PR introduces an opt-in formatted data cache pipeline to improve export throughput and post-warmup grid rendering responsiveness on large datasets.
It adds asynchronous background cache population in
SlickDataView, keyed by item id, for:formattedDataCache)formattedCellCache)The pipeline uses batched, time-budgeted processing (
MessageChannelwithrequestAnimationFramefallback), supports row-level and full cache invalidation on data changes, and preserves existing cache-disabled/cache-miss behavior.SlickGridnow reads from the display cache in formatter flow when safe, and Excel/PDF/Text export paths use cache-first reads with fallback to live formatter logic so sanitize/decode/parsing behavior remains consistent.Architecture note
The implementation is planner-based:
SlickGridprovides a single formatted cache planner callbackSlickDataViewuses that planner to classify columns and build cache contextValidation
Validation was done with focused unit tests for:
Tests and coverage are green on this branch.
Why this helps
This specifically targets formatter-heavy, large-grid workloads like the scenario discussed here:
#1922
Impact
Technical implementation
See FORMATTED_DATA_CACHE_IMPLEMENTATION.md
Live Demo Test (Example 03 with 500K rows)
Excellent results! 🎉 That's a massive validation of the implementation:
Performance Summary (500K rows, 8 columns):
What makes this successful:
clearFormattedDataCache())The cache is doing exactly what it's designed for—trading a one-time 13-minute background population for consistent 30-35 second exports on huge datasets. Without the cache, that export would likely take 5+ minutes or hang.