Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upPerformance issue in CSSStyleDeclaration::set_property #17399
Comments
|
cc @emilio @jdm @bholley @SimonSapin since I'm not sure who knows this stuff best. |
|
Hmmm, I wonder if there is a (relatively) easy way I could hack out the ToCss usage in setProperty, for testing the potential improvement locally? |
|
Applying the follow diff as a hack changes the frame rate on my machine from 39 to 52 fps in this test.
|
|
|
|
I think the right fix for this, in particular for the style attribute is not storing the serialized string anywhere. This also applies for other attribute values, fwiw... |
|
Gecko serializes and caches the string on demand, but does not cache when in a servo restyling traversal (i.e. when off-main-thread).
|
|
@emilio are you working on this? If so, do you have a rough timeline? We're hoping to get this fixed for demos at all hands, but we can use the hack to disable serialization as a stop gap for next week if needed. |
|
I think this may be marginally more up @SimonSapin's alley, given that he's looking into parsing/serialization performance on stylo right now. But it's probably more a question of who has cycles to look at it. |
|
@pcwalton, you said on IRC you’d try to remove |
|
I started but stopped working on it because @emilio said that he was working on it. |
|
I was using khuey's |
|
My idea was to remove the Current WIP is https://github.com/emilio/servo/tree/attrs. That requires implementing
Using |
Not URL? |
|
It gets resolved when appropriate. At least that's how the code works as of right now, and |
|
Oh, |
Serialize style attributes on demand… … rather than every time that CSSOM `Element.style` is modified. Results are *not* cached in this PR. We could add APIs that work with `&mut AttrValue` rather than `&AttrValue` to add some caching. CC #17399 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17476) <!-- Reviewable:end -->
I don’t think we can remove |
Serialize style attributes on demand… … rather than every time that CSSOM `Element.style` is modified. Results are *not* cached in this PR. We could add APIs that work with `&mut AttrValue` rather than `&AttrValue` to add some caching. CC #17399 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17476) <!-- Reviewable:end -->
Serialize style attributes on demand… … rather than every time that CSSOM `Element.style` is modified. Results are *not* cached in this PR. We could add APIs that work with `&mut AttrValue` rather than `&AttrValue` to add some caching. CC #17399 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17476) <!-- Reviewable:end -->
I'm profiling the Multiply test in the MotionMark benchmark suite - the major bottleneck in this test is the rAF call.
In this test, most of the time is spent in the (many) calls to
set_backgroundColorandset_Transform.If we zoom in on these calls, we seem to spend a lot of time in the
ToCssimplementation, and also quite a lot of time inSharedRwLock::read.@emilio mentioned in another bug:
Questions:
If removing the ToCss call here is feasible, that could potentially halve the cost of our
setPropertycalls, which would be a massive win in this benchmark.