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

FYI: Regenerate entire style instead of diffing #1886

Closed
syranide opened this issue Jul 19, 2014 · 0 comments
Closed

FYI: Regenerate entire style instead of diffing #1886

syranide opened this issue Jul 19, 2014 · 0 comments

Comments

@syranide
Copy link
Contributor

@zpao brought up the idea of using cssText instead of diffing styles the other day... I didn't think it would be a good idea. I was apparently very much wrong because the cost of cssText seems to very identically to all other properties, so for 1 style, it's the same, but for 4 styles it really takes off. Performance also seems consistent across all browsers.

I messed up the test... buuuuuut, there is a significant benefit with no persistent styles, it's even more emphasized for the slower browsers. The thing that sticks out the most for me is that cssText is a lot more uniform in performance, whereas using properties is significantly worse in worst-case. However, with 4 persistent styles in-place, cssText loses big-time.

So it seems that it very much depends, if we want to suck every last piece of performance out and we could implement a fast routine (good thresholds are probably the biggest issue) that could intelligently use cssText or properties there could be quite a big win here though (for real). But I don't think have 2 different paths is a good thing, and this would only be applicable in certain cases (but perhaps rather common still).

http://jsperf.com/faststyle (4 persistent styles)
http://jsperf.com/faststyle/2 (no persistent styles)

@syranide syranide changed the title RFC: Regenerate entire style instead of diffing FYI: Regenerate entire style instead of diffing Jul 19, 2014
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