-
Notifications
You must be signed in to change notification settings - Fork 31
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
rstats is causing a full document layout on each update #2
Comments
Update: Setting an explicit pixel height and |
Good points. I've updated the lib so it fixes the full document layout (fixing overflow and setting height) Regarding the textContent causing layout thrashing, I've tried several approaches, including the textNode.nodeValue, but there's no difference. I'll try a specific test case and see what I find. |
I also looked into setting textContext vs nodeValue and couldn't get chrome to report differently either. So I'm really hopeful you'll figure something out! |
@spite So... nearly 10 years later! Today I discovered what was causing the layout thrashing, after recently including rstats in a new project.
The Chrome devtools > Rendering have a Layout Shift Regions checkbox. It seems that whenever a number changes digits, whether it's Hope you're well! |
On your example pages (as well as my own experiments), I'm seeing a full document layout in Chrome:
It's only taking around 0.5ms, but I still find it strange that rstats is forcing the entire document to relayout. And in terms of a single frame, that's almost 3% of the total time allotted for 60fps. Obviously rendering rstats is not free, but it should ideally use as little time as possible.
Thanks for making rstats, it's been really cool to use!
The text was updated successfully, but these errors were encountered: