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

CommentSection layout is very expensive while scrolling #10748

Open
Cwiiis opened this issue Dec 17, 2024 · 1 comment · May be fixed by #10772
Open

CommentSection layout is very expensive while scrolling #10748

Cwiiis opened this issue Dec 17, 2024 · 1 comment · May be fixed by #10772
Assignees
Labels
bug Something isn't working unconfirmed

Comments

@Cwiiis
Copy link
Contributor

Cwiiis commented Dec 17, 2024

Describe the Bug

If there are comment sections in a writer document (such as in the test document), layout of those sections shows up very high in the profile while scrolling. The comment sections only change their position while scrolling, so there's obviously a lot of expensive DOM queries going uncached here. Fixing this ought to markedly improve scrolling performance on documents with lots of comments.

Steps to Reproduce

  1. Open the test Writer document, start profiling and scroll up and down with the mouse wheel for a while.
  2. Observe that CommentSection.prototype.doLayout takes a significant portion of time

Drilling down into what's expensive, particularly getCommentHeight shows up taking almost half of the time (with most of that being getBoundingClientRect), and then what is presumably unnecessary class manipulation also shows up quite highly.

Expected Behavior

Given the comments are only changing position, I wouldn't expect any function within their class beyond setting their position to show up significantly in the profile.

@Cwiiis Cwiiis added bug Something isn't working unconfirmed labels Dec 17, 2024
@Cwiiis Cwiiis self-assigned this Dec 17, 2024
@Cwiiis
Copy link
Contributor Author

Cwiiis commented Dec 19, 2024

Note, #10772 doesn't fix that CommentSection.isEdit is really expensive and probably easily cacheable (but I don't know the class well enough immediately to do that quickly)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant