Closed Bug 1983704 Opened 6 months ago Closed 6 months ago

Simplify AutoTArray guts

Categories

(Core :: XPCOM, task)

task

Tracking

()

RESOLVED FIXED
144 Branch
Tracking Status
firefox144 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

(Keywords: perf-alert)

Attachments

(2 files)

Landing this separate from bug 1978229 for convenience and easier tracking of potential regressions.

While looking into the previous patch, I realized there's a scary
mismatch between what the is-auto bit means for rust's ThinVec and
Gecko's AutoTArray.

Rust's ThinVec assumes that the is-auto bit means that the buffer itself
is stack-allocated, but that's not correct: Gecko will set mIsAutoArray
for heap-allocated buffers that replace a non-heap allocated buffer.
This is used so that when shrinking the array we can go back to point to
the stack-allocated buffer. This is all a bit hacky as noted by the
various comments here.

The point is that, if we were to get here with one such buffer, we'd
leak: https://searchfox.org/mozilla-central/rev/1177f9aa639e8bbb6633441064ab9dbc846a1998/third_party/rust/thin-vec/src/lib.rs#1673

I think right now we can't even get there, except if somehow you
mem::swap or so a ThinVec, which is rather dangerous anyways as
explained in the Crate's documentation.

I'm not convinced that's worth preserving all that complexity, as most
AutoTArrays are temporary. Simplify how AutoTArray is dealt with, so
that the rust usage is sound.

I made AutoTArray::Clear() point back to the stack-allocated buffer
because it's an easy way of getting the old behavior back if some
consumer needs it... I'll of course run this through performance
tests...

Assignee: nobody → emilio
Status: NEW → ASSIGNED

After the previous patch it's unused. Conceptually it's the right thing
to do if nsTArray wanted to ever deal with over-aligned types. But that
doesn't seem to be the case for now, so maybe worth taking the
simplification?

Backed out for causing assertion failures.

Flags: needinfo?(emilio)
Flags: needinfo?(emilio)
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 144 Branch

Improved the size of the installer on windows-non-shippable by 247KB (0.2%)

Blocks: 1984102
Regressions: 1985271
Regressions: 1985273

(In reply to Pulsebot from comment #4)

Pushed by agoloman@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/2dfc8587c8c0
https://hg.mozilla.org/integration/autoland/rev/b38d5edaed3c
Revert "Bug 1983704: apply code formatting via Lando" for causing assertion
failures.

Perfherder has detected a browsertime performance change from push b38d5edaed3c99631ddca9e811ac8d7bfd60adb2. 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. Our guide to handling regression bugs has information about how you can proceed with this investigation.

If you have any questions or need any help with the investigation, please reach out to a performance sheriff. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Regressions:

Ratio Test Platform Options Absolute values (old vs new) Performance Profiles
5% speedometer Preact-TodoMVC/CompletingAllItems macosx1500-aarch64-shippable fission webrender 1.65 -> 1.73 Before/After
4% speedometer VueJS-TodoMVC/CompletingAllItems macosx1500-aarch64-shippable fission webrender 2.38 -> 2.47 Before/After
3% speedometer Inferno-TodoMVC/CompletingAllItems macosx1500-aarch64-shippable fission webrender 7.50 -> 7.76 Before/After
3% speedometer Preact-TodoMVC macosx1500-aarch64-shippable fission webrender 5.05 -> 5.19 Before/After

Improvements:

Ratio Test Platform Options Absolute values (old vs new) Performance Profiles
7% speedometer VueJS-TodoMVC/Adding100Items/Sync linux1804-64-shippable-qr fission webrender 3.41 -> 3.15
7% speedometer Preact-TodoMVC/Adding100Items/Sync linux1804-64-shippable-qr fission webrender 1.87 -> 1.73

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

If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a performance sheriff to do that for you.

You can run all of these tests on try with ./mach try perf --alert 46372

The following documentation link provides more information about this command.

Keywords: perf-alert
Regressions: 1985292
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: