-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Improve tree rendering performance #1088
Comments
Flagging @cagataycivici - if I submit a pull request on Friday Oct 21, can you merge it in before next Wednesday? |
Profiling info I created two CPU profiles using the chrome profiler. During each, I ran the profiler for 45 seconds while moving the mouse over the app to trigger change detection. In the first test, the tree contained 500 items and completing one change detection iteration took up to 100ms: When the tree contains only 15 items completing one change detection iteration was much much faster. It typically took around 8ms, however you can see that there are long stretches of idle time between the change detection cycles: |
Please do a PR and we'll review. At first glance this makes sense for sure. |
Thanks for the response. Moved onto a new project so won't have time to do a PR for this. For anyone else with similar issues, I hacked my TreeNode to do the following:
There are some other usecases, that you have to handle. For example, when the selected node is collapsed, you may want to reset the selection since the Tree will no longer have the selected node. This seems like an invalid state. |
Thank you, I'll review. |
I have a tree in my app that has 500 items. Unfortunately, I am running into CPU performance issues because each of the items in the tree corresponds to a new Angular2 component. Running change detection on each of these components is slow and my app is becoming unresponsive.
I am planning on working around this problem by modifying my TreeNodes
get children
getter/method to only return items when the tree node is expanded, however this feels like a hack. It seems to me like the tree should only create components (and put items in the dom) for TreeNodes that are currently expanded.I think that this may be fairly straight-forward to implement. Currently the
p-treeNode
looks like this:I think that updating it to this, would be much faster:
I haven't tested this change but I would happy test it and submit a pull-request tomorrow, if we could get this change in by Wednesday next week (Oct 26). My project is going final very shortly and having this functionality (in a non-hacky way) would be very beneficial.
The text was updated successfully, but these errors were encountered: