Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Lag from frequent style recalculations on profiles due to mouse and scroll position CSS variables #979

Open
khang06 opened this issue Dec 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@khang06
Copy link

khang06 commented Dec 5, 2024

Describe the bug
Profiles start to get very laggy after scrolling down for a while. Some profiling shows that this happens due to the CSS variables introduced in #875 causing a full style recalculation after every mouse move/scroll input, which starts to scale really badly after scrolling through enough pages, even if the profile has no custom CSS! In one case, I had each style recalculation take as long as ~300ms.

Screenshots
image

Browser
Thorium 128.0.6613.189

Links
Should happen on any profile after scrolling enough, but the screenshot was from https://x.com/hourly_shitpost

OldTwitter version
v1.8.9.6

@khang06 khang06 added the bug Something isn't working label Dec 5, 2024
@dimdenGD
Copy link
Owner

dimdenGD commented Dec 5, 2024

I never seemed to have this problem, so if you can, you'll need to make a PR yourself so you'd be able to see if you fixed it or not

@khang06
Copy link
Author

khang06 commented Dec 5, 2024

I never seemed to have this problem, so if you can, you'll need to make a PR yourself so you'd be able to see if you fixed it or not

It gets rid of the problem if I comment out the two event handlers on my local copy. Works for me since I don't care about custom CSS, but I don't think I should PR removing that feature for everyone. Maybe only registering the handlers if they're actually referenced in the CSS would be a good middle ground? It wouldn't completely solve the problem but I can't think of a way to implement this as-is without the eventual performance issues.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants