DataTable: Slow filter and sort performance with large datasets #4007
Labels
Type: Enhancement
Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone
Describe the bug
Filter and sort performance is slow when dealing with large numbers of filters and/or large datasets with the DataTable component.
This seems to be due to a couple of things:
ObjectUtils.resolveFieldData
within thecompareFn
function passed tosort
.ObjectUtils.resolveFieldData
is relatively slow. Doing an expensive function call within thecompareFn
means that sort performance scales poorly with dataset size.value
is null, which is performed for each item in the data array. If a filter value isnull
, this filter is still assessed, which also involves a call toObjectUtils.resolveFieldData
. This means that filters on many columns leads to poor performance when filtering or sorting, even if those filters aren't active.I'm raising this issue as part of a PR that aims to improve performance for both sort and filter routines in the DataTable component.
Reproducer
https://codesandbox.io/s/priceless-sound-jwo4kl
PrimeVue version
3.29.1
Vue version
3.x
Language
ES6
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: