-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: poor performance #3812
Comments
Related to: #2979 ??? |
You are right if you remoe dataKey and just let it use the index you can see its twice as fast and only takes about 1 second. |
Right, I was confused at first, but that makes sense, because in that case React is able to reuse many DOM nodes, as their keys will be the same, even though they map to different domain elements. Ideally, though, domain keys should be used, as recommended by the React team. |
@melloware sorry to bother you with this, but do you happen to know when this feature might be released? I'm having some noticeable performance problems in my application and have high hopes for this fix |
Sorry I don't have any insight on release timelines |
Describe the bug
I've been noticing that the table has a really hard time keeping up with soft real time updates. At first I thought it was a limitation of React (I still think that plays a role), but I believe there are opportunities for optimization within PrimeReact.
One thing I noticed looking at the code is that domain keys aren't truly respected, see
primereact/components/lib/datatable/TableBody.js
Line 162 in 245c3c7
The index is appended to the domain key, kind of missing the entire point of providing one. For anything other that additions at the bottom of the table (this includes filtering, sorting, etc.) the key won't be the same between renders, so React will have to recreate all DOM nodes.
There are likely more optimizations to be made, that somebody familiar with the codebase might be able to exploit. I encourage you to do some profiling to try and have a super-snappy table ⚡
Reproducer
https://codesandbox.io/s/primereact-test-forked-qhesvo?file=/src/index.js
PrimeReact version
8.7.3
React version
17.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
key
attribute may be the cause here.Expected behavior
No response
The text was updated successfully, but these errors were encountered: