Significantly improve filtering and sorting performance for large datasets (500k+ rows) #196
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.
This is an attempt to improve filtering and sorting on larg datasets.
This is a first attempt to solve #195
This commit introduces a major refactor and optimization of the TableView filtering and sorting logic to address severe performance issues with large datasets (500,000+ rows).
Unified fast code path for sorting and filtering, used by both header clicks and options flyout, ensuring consistent and optimal performance.
Parallelized filtering and sorting using chunked processing and ConcurrentDictionary for thread safety and speed.
Smart caching of unique filter values, with cache keys that include filter state, to avoid unnecessary recomputation.
Scroll position preservation: The horizontal scroll position is now reliably preserved and restored during data operations, eliminating UI jumps.
Improved blank/null value handling in filters, ensuring consistent user experience.
API additions: Added ApplyUnifiedSort and ClearUnifiedSort to IColumnFilterHandler for unified, fast sorting from any UI entry point.
Error handling and thread safety: Added guards against infinite loops, race conditions, and UI glitches during data operations.
These changes dramatically reduce the time required for filtering and sorting on very large datasets, making TableView responsive and usable at scale.
My tests resulted in significant improvements, so i made it ready to review and test or discuss further.