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

Performance bottleneck #5

Closed
YeskaNova opened this issue Oct 16, 2019 · 3 comments · Fixed by #6
Closed

Performance bottleneck #5

YeskaNova opened this issue Oct 16, 2019 · 3 comments · Fixed by #6

Comments

@YeskaNova
Copy link

Hi,

Thank you for the awesome infinit-tree library. When I try to load 80k+ nodes under a single node, this line incredibly slows down the loading :

if (node.isLastChild()) {

I think you can change this line with a less expensive check :
if(index === current.children.length-1)

I gained 1.4 seconds with this. Can you confirm that I didn't break something ? It seems to me that the original check does a long roundtrip to just do that simple check.

Thank you,

Yassine

@cheton
Copy link
Owner

cheton commented Oct 17, 2019

That's a good point. This change will definitely reduce the time for searching the array for the specified node. Thank you for the finding.

cheton added a commit that referenced this issue Oct 17, 2019
@YeskaNova
Copy link
Author

Thank you.

@cheton
Copy link
Owner

cheton commented Oct 17, 2019

Just published 0.11.1 to address the performance issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants