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

Improve performance of updateVisualMaxTreeLevel when animation is disabled #3384

Closed
wants to merge 1 commit into from

Conversation

valadaptive
Copy link

Resolves #3383.

With animation disabled, we were previously updating the max tree level every time we received a tab event. When closing large numbers of tabs, this gets extremely slow.

This PR changes it to batch the updates so they only occur once per frame at most.

I wasn't sure whether to go with a 0ms delay (so it appears instantaneous) or a 100ms delay (like reserveToUpdateIndent does just below). I went with a 0ms delay in the end so as to preserve existing behavior.

Maybe for a future PR, it would be nice to do something like what Lodash.debounce offers with options.leading: the first time we receive the event, we apply it instaneously, but every event after that gets queued up with a certain delay. This would prevent visual feedback from being too delayed, while giving a good "buffer zone" to avoid updating too frequently.

When closing many tabs at once with animation disabled, we would
previously call updateVisualMaxTreeLevel for every tab close event we
received. This is extremely slow. Instead, delay the update until the
next frame to batch multiple tab close events together.
@piroor
Copy link
Owner

piroor commented Nov 1, 2023

Thanks a lot, but I have a concern: this change introduces a visual regression. When a deeply nested tree is expanded, you'll see an expanded tree with old indentations and it is updated to correct indentations with a delay. Hmm, how can we avoid that...

@piroor
Copy link
Owner

piroor commented Nov 1, 2023

I close this PR because it is outdated by the change 5fa5f8d which is inspired from this PR. Thanks again!

@piroor piroor closed this Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Closing multiple tabs is slow if animation is disabled
2 participants