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

Forced reflow due to reading and writing css property in a single loop #176

Open
martinarvaiaccedo opened this issue Nov 9, 2024 · 0 comments

Comments

@martinarvaiaccedo
Copy link

Hey!

In the following block: https://github.com/jhildenbiddle/css-vars-ponyfill/blob/master/src/index.js#L304-L320
reads and writes are happening in the same loop which causes as many forced reflows, as many variables it will attach. Even an M2 mac can hang for 32ms, on our supported devices (Smart TVs) the same process causes a 4 second freeze when setting 20-30 variables.

m2 mac
image

Samsung Tizen 2021 (a quite performant model)
image

As a quick workaround, I applied the following patch in our project:

css-vars-ponyfill+2.4.9.patch

Samsung Tizen 2021 with the proposed fix: (from 4000ms to 91ms)
image

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

No branches or pull requests

1 participant