Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Bypass the lock in get_property_value #18386
This measurably improves performance - see https://bugzilla.mozilla.org/show_bug.cgi?id=1355599#c21
I'm with @SimonSapin here that we probably shouldn't take this.
42ms in 1M getting doesn't really sound like a huge problem, and given that Blink is even slower here, it is probably not a very critical thing needs to be optimized that much. Also since we are getting closer to beta uplift, this really seems to be the kind of change that has certain risk without a big improvement.
It is true that CSSOM happens only in the main thread, so the change itself should be safe. But in case we mess things up somehow, this could lead to more weird behavior and obscure crash reports.
@upsuper and I discussed this on IRC. The important bits are:
I agree we should default to provably-safe patterns, but when a performance tradeoff arises we need to weigh the performance impact against the benefit. And given that this particular tradeoff is about checking for mutable aliasing in stack frame N, but stack frames N-1...0 are in C++ and have no protections against mutable aliasing, I don't think the protections are buying us much.
Bypass the lock in get_property_value This measurably improves performance - see https://bugzilla.mozilla.org/show_bug.cgi?id=1355599#c21 <!-- 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/18386) <!-- Reviewable:end -->
This brought a noticeable improvement:
== Change summary for alert #9251 (as of September 06 2017 06:09 UTC) ==
5% Stylo Servo_DeclarationBlock_GetPropertyById_Bench windows7-32 opt 232,901.17 -> 221,106.42
For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=9251