OldTwitter icon indicating copy to clipboard operation
OldTwitter copied to clipboard

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

Open khang06 opened this issue 1 year ago • 2 comments

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 avatar Dec 05 '24 02:12 khang06

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

dimdenGD avatar Dec 05 '24 15:12 dimdenGD

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.

khang06 avatar Dec 05 '24 17:12 khang06

is there any update on this

M0chaCat avatar Jul 02 '25 19:07 M0chaCat

still waiting on that pr, extremely niche feature anyways

dimdenGD avatar Jul 02 '25 19:07 dimdenGD