Simplify AutoTArray guts
Categories
(Core :: XPCOM, task)
Tracking
()
| 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.
| Assignee | ||
Comment 1•6 months ago
|
||
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...
Updated•6 months ago
|
| Assignee | ||
Comment 2•6 months ago
|
||
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.
| Assignee | ||
Updated•6 months ago
|
Comment 7•6 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/9b0e0cbbbc4f
https://hg.mozilla.org/mozilla-central/rev/db835f2a3f57
Comment 8•6 months ago
|
||
Improved the size of the installer on windows-non-shippable by 247KB (0.2%)
Comment 9•6 months ago
|
||
0.7% improvement on heap-unclassified
0.3% on Base content explicit
Comment 10•6 months ago
|
||
(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.
Description
•