Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable: Slow filter and sort performance with large datasets #4768

Closed
melloware opened this issue Aug 12, 2023 · 0 comments · Fixed by #4769
Closed

DataTable: Slow filter and sort performance with large datasets #4768

melloware opened this issue Aug 12, 2023 · 0 comments · Fixed by #4769
Assignees
Labels
Type: Performance Issue is performance or optimization related
Milestone

Comments

@melloware
Copy link
Member

melloware commented Aug 12, 2023

Describe the bug

Confirmed from PrimeVue: primefaces/primevue#4007

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:

  • Large numbers of calls to ObjectUtils.resolveFieldData within the compareFn function passed to sort. ObjectUtils.resolveFieldData is relatively slow. Doing an expensive function call within the compareFn means that sort performance scales poorly with dataset size.
  • Executing filters even when the filter value is null, which is performed for each item in the data array. If a filter value is null, this filter is still assessed, which also involves a call to ObjectUtils.resolveFieldData. This means that filters on many columns leads to poor performance when filtering or sorting, even if those filters aren't active.
  • Big performance gain using Int.Collator. It is not recommended to use localeCompare against large arrays.
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare

Reproducer

No response

PrimeReact version

9.6.0

React version

18.x

Language

ALL

Build / Runtime

Create React App (CRA)

Browser(s)

ALL

Steps to reproduce the behavior

No response

Expected behavior

Better performance while sorting and filtering.

@melloware melloware added the Type: Performance Issue is performance or optimization related label Aug 12, 2023
@melloware melloware self-assigned this Aug 12, 2023
@melloware melloware added this to the 10.0.0 milestone Aug 12, 2023
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 12, 2023
@melloware melloware removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 12, 2023
melloware added a commit to melloware/primereact that referenced this issue Aug 12, 2023
melloware added a commit to melloware/primereact that referenced this issue Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Performance Issue is performance or optimization related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant