I'm sitting here looking at the setProperty code and I can't understand how that's possibly true; invokes parsing: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/css/StylePropertySet.cpp?type=cs&l=321 …
-
-
Replying to @slightlylate @DavidKPiano and
Might get fewer property invalidations, but you trade that for more passes through the bindings; not a trade I'd naively make (need to test)
1 reply 0 retweets 0 likes -
Replying to @slightlylate @ElliottZ and
Here's the numbers (let me know if I can improve this test): https://esbench.com/bench/5908f78199634800a0347e94 …pic.twitter.com/vq4sjYvgFw
1 reply 0 retweets 3 likes -
Replying to @DavidKPiano @ElliottZ and
This is measuring throughput of the bindings, looks like. Maybe parsing perf. But not style resolution.
1 reply 0 retweets 0 likes -
Replying to @slightlylate @ElliottZ and
What's the best way of testing style resolution then?
1 reply 0 retweets 0 likes -
Replying to @DavidKPiano @ElliottZ and
put an offsetWidth read call inside your hot loop and make sure values alternate.
1 reply 0 retweets 0 likes -
Replying to @slightlylate @DavidKPiano and
Also, recommend taking
@ElliottZ's advice and look at .classList addition/removal too.1 reply 0 retweets 1 like -
Replying to @slightlylate @ElliottZ and
Oh, interesting!pic.twitter.com/0UU1Jqcb0u
1 reply 1 retweet 5 likes -
Replying to @DavidKPiano @slightlylate and
Your benchmark is wrong for .cssText, you do: .cssText = 'green'; but that's not valid CSS :P Try .cssText = 'color: green'
1 reply 0 retweets 1 like -
Replying to @ElliottZ @slightlylate and
Good catch - updated, it's still faster than setProperty and setters, but classList and className are fastest.
1 reply 1 retweet 5 likes
Slightly relieved that my understanding of the style system is not so dated that as to be incorrect ;-)
-
-
-
Replying to @_developit @slightlylate and
Who knew the fastest way to style components is to use completely invalid styles?
0 replies 0 retweets 14 likes
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
& Web Standards TL; Blink API OWNER
Named PWAs w/
DMs open. Tweets my own; press@google.com for official comms.