Closed Bug 2068601 Opened 2 months ago Closed 2 months ago

30.92 - 6.12% perf_reftest_singletons bloom-basic-2.html + 7 more (Linux, OSX, Windows) regression on Thu August 27 2026

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED FIXED
157 Branch
Tracking Status
firefox-esr140 --- unaffected
firefox-esr153 --- unaffected
firefox155 --- unaffected
firefox156 --- disabled
firefox157 --- fixed

People

(Reporter: performance-sheriff-bot, Assigned: emilio)

References

(Regression)

Details

(4 keywords)

Attachments

(2 files, 1 external file, 1 obsolete file)

Perfherder has detected a talos performance regression from push dba49edca099917d2a2e8fd87478e4404d999f57. As author of one of the patches included in that push, we need your help to address this regression.

Please acknowledge, and begin investigating this alert within 3 business days, or the patch(es) may be backed out in accordance with our regression policy.

Regression Test Platform Options Absolute values [old vs new]
31% perf_reftest_singletons bloom-basic-2.html (doc) linux2404-64-shippable e10s fission stylo webrender 37.72 ms -> 49.38 ms
31% perf_reftest_singletons bloom-basic.html (doc) linux2404-64-shippable e10s fission stylo webrender 37.59 ms -> 49.08 ms
30% perf_reftest_singletons attr-selector-1.html (doc) windows11-64-24h2-shippable e10s fission stylo webrender 47.25 ms -> 61.65 ms
17% perf_reftest_singletons bloom-basic-2.html (doc) windows11-64-24h2-shippable e10s fission stylo webrender 19.56 ms -> 22.90 ms
17% perf_reftest_singletons bloom-basic.html (doc) windows11-64-24h2-shippable e10s fission stylo webrender 19.67 ms -> 22.95 ms
14% perf_reftest_singletons parent-basic-singleton.html (doc) windows11-64-24h2-shippable e10s fission stylo webrender 36.52 ms -> 41.78 ms
10% perf_reftest_singletons bloom-basic.html (doc) macosx1470-64-shippable e10s fission stylo webrender 39.18 ms -> 43.10 ms
6% perf_reftest_singletons many-custom-props.html (doc) macosx1470-64-shippable e10s fission stylo webrender 221.37 ms -> 234.92 ms

Support & Actionable Steps

For questions, please contact afinder@mozilla.com. You can also find help on Slack (#perf-help) or Matrix (#perftest).

Action guide details:

Flags: needinfo?(emilio)

Set release status flags based on info from the regressing bug 2048847

Ok so I understand what's going on. The Subject path is confusing LLVM a bit. Since selectors takes a reference it grows the inner loop hot path substantially in Rule::matches_selector.

I have a simple approach that restores the performance. But that made me think that maybe we should just make selectors take the elements by value, maybe even going all the way to force selectors::Element to be Copy... And that indeed also squeezes a bit more performance.

We can probably keep the Clone bound for convenience if you're doing something not very performance sensitive...

Nico, any objection to just switching selectors to require E by value? in its public API surface? IIRC you're consuming the crate downstream. It would require some clones upfront if your elements aren't cheap (but tbh if you're doing selector-matching you probably can / want the elements to be Copy / a lightweight reference.

Oriol, this was a bit annoying for Gecko because of the snapshotting stuff (but nothing too crazy). Just double-checking that Servo doesn't have a more complicated mechanism / other selectors::Element implementations that would make this a lot more painful / intractable?

Flags: needinfo?(oriol-bugzilla)
Flags: needinfo?(nico)

The issue seems to be that since we're passing element by value, and
mutating, but then passing it by reference around to selectors llvm adds
a stack-to-stack copy of the element per iteration, which grows this
super-hot loop enough.

Measured locally, but try push imminent.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

Removes some unnecessary indirection. Locally this recovers the
regression, and then some.

We could keep the Clone bound if needed / avoid Copy. It's just a bit
annoying tho.

See Also: → 2068780

Our selectors::Element impl in Blitz is on &'a Node (i.e. a reference to our DOM Node type). So I think Copy should be fine (& references are trivially Copy) so long as 'static isn't required. Indeed, it seems like a nice improvement as it will mean we're not passing a double-reference (I guess probably with current selectors we ought to be implementing the trait directly on Node, with the proposed setup our current impl will be correct).

See: https://github.com/DioxusLabs/blitz/blob/main/packages/blitz-dom/src/stylo.rs#L317

(probably at some point we'll impl this on a private newtype wrapper so we can keep our Stylo impls private, but I don't think that affects anything here)

Flags: needinfo?(nico)
Flags: needinfo?(emilio)

So comment 9 is a lot more mixed than I expected, probably due to the ElementWrapper eager snapshot lookup...

The regressor Bug 2048847 was reverted from Fx156 beta

Blocks: 2069004
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 157 Branch

Comment on attachment 9635609 [details]
Bug 2068601 - Make selector matching pass elements by value. r=#style

Revision D323074 was moved to bug 2069004. Setting attachment 9635609 [details] to obsolete.

Attachment #9635609 - Attachment is obsolete: true

Perfherder has detected a talos performance change from push aeb5b9469c52f226708d853614c5f0d52e9aa41b.

No action is required from the author; this comment is provided for informational purposes only.

Improvement Test Platform Options Absolute values [old vs new]
13% perf_reftest_singletons bloom-basic.html (doc) linux2404-64-shippable e10s fission stylo webrender 48.50 ms -> 42.42 ms
11% perf_reftest_singletons bloom-basic-2.html (doc) linux2404-64-shippable e10s fission stylo webrender 47.76 ms -> 42.42 ms

Need Help or Information?

If you have any questions, please reach out to afinder@mozilla.com. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

QA Whiteboard: [qa-triage-done-c158/b157]

No problem for Servo from this or bug 2069004.

Flags: needinfo?(oriol-bugzilla)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: