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

[TreeView] Performance issue on TreeView with large data set #10300

Closed
2 tasks done
satyajitrout58 opened this issue Sep 10, 2023 · 5 comments
Closed
2 tasks done

[TreeView] Performance issue on TreeView with large data set #10300

satyajitrout58 opened this issue Sep 10, 2023 · 5 comments
Assignees
Labels
component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! performance

Comments

@satyajitrout58
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example: https://stackblitz.com/edit/react-eywhbq-ldiizc?file=Demo.tsx,index.tsx

Steps:

  1. Collapse tree items which all have subitems inside them. It takes some time to display.
  2. Click on the Add Item button to add a new item to the existing tree items.
  3. When we have more than 5,000 tree items if we collapse or add any item stack overflow and page unresponsive error is coming.

Current behavior 😯

  1. When we have more than 1000 items there is a delay while collapsing tree items.
  2. When we have more than 5,000 tree items if we collapse or add any item stack overflow and page unresponsive error is coming.

Expected behavior 🤔

  1. All the operations should be faster when we have more than 1000 tree items

Context 🔦

No response

Your environment 🌎

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Order ID or Support key 💳 (optional)

No response

@satyajitrout58 satyajitrout58 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 10, 2023
@noraleonte noraleonte added the component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! label Sep 11, 2023
@noraleonte noraleonte changed the title Getting page unresponsive error and delay issue when we collapse or add treeitems with more than 1000 items in mui-treeview [TreeView] Getting page unresponsive error and delay issue when we collapse or add treeitems with more than 1000 items in mui-treeview Sep 11, 2023
@noraleonte noraleonte changed the title [TreeView] Getting page unresponsive error and delay issue when we collapse or add treeitems with more than 1000 items in mui-treeview [TreeView] Performance issue on TreeView with large data set Sep 11, 2023
@noraleonte
Copy link
Contributor

Hey @satyajitrout58 👋

Thanks for opening up this issue being interested in the TreeView 🤙

Right now the component is not particularly optimized for supporting large datasets, but performance optimization in this sense is one of our main priorities for the upcoming months as we are redirecting more effort towards developing the TreeView.
I renamed and labeled the issue accordingly, and we will update you here once we have an improvement.

@DirKraft91
Copy link

@flaviendelangle, @noraleonte Has it been fixed? Seeing the same problems with 1000 elements and more...

@flaviendelangle
Copy link
Member

flaviendelangle commented Jul 17, 2024

Hi,

This is not something we can "fix", in order to support large dataset we need to introduce virtualization.
We did some optimizations on the internals of the Tree View to avoid extensive computations, and we have others to do (e.g.: switch to a subscription model for the item updates so that when you do a change that only impacts one item visually, then the other items do not re-render).
But to have good or even decent performances on large datasets, the only viable option is to no render every item, otherwise you always end up with super long mounting time and super long update time on interactions that impact all the items (selecting all of them using Ctrl + A for instance).

I'm exploring what virtualization could look like in #13520.

In summary, here are the big steps of performance improvement in the Tree View:

  • Reduce complexity on Tree View internals (do not loop on the items whenever we can avoid it)
  • Add virtualization to only render the items visible in the viewport
  • Let the items subscribe to the data they need instead of using api methods so that we can use React.memo on them

Sorry, something went wrong.

@flaviendelangle
Copy link
Member

By the way, I used this issue to track the 1st big step, I'll close it now that this one is over.
You can have a look at #9685 for the next step 👍

Copy link

⚠️ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@satyajitrout58: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! performance
Projects
None yet
Development

No branches or pull requests

4 participants