Closed Bug 1887697 Opened 8 months ago Closed 8 months ago

Avoid nsTArray<>::Sort to use ElementAt with bounds check while sorting

Categories

(Core :: XPCOM, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
126 Branch
Tracking Status
firefox126 --- fixed

People

(Reporter: jstutte, Assigned: jstutte)

References

Details

(Keywords: perf-alert)

Attachments

(1 file)

Coming from bug 1848765 made me think, we should do the same as we do for StableSort, that is pass the plain C/C++ array via Elements() to std::sort to avoid bounds checking.

See Also: → 1848765

We are aware of the fact that std::sort does no bounds checks at all and
can be derailed by bad comparators, but we assume we will catch bad
comparators with tests in DEBUG builds and can go for full speed here.

Assignee: nobody → jstutte
Status: NEW → ASSIGNED

Is "whith" in the summary supposed to be "without"?

Flags: needinfo?(jstutte)

(In reply to Andrew McCreight [:mccr8] from comment #2)

Is "whith" in the summary supposed to be "without"?

It's supposed to be "with", given the "Avoid".

Flags: needinfo?(jstutte)
Summary: Avoid nsTArray<>::Sort to use ElementAt whith bounds check while sorting → Avoid nsTArray<>::Sort to use ElementAt with bounds check while sorting
Attachment #9393105 - Attachment description: Bug 1887697 - Avoid nsTArray<>::Sort to use ElementAt whith bounds check while sorting. r?#xpcom-reviewers → Bug 1887697 - Avoid nsTArray<>::Sort to use ElementAt with bounds check while sorting. r?#xpcom-reviewers
Pushed by jstutte@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f4efdaac44d1 Avoid nsTArray<>::Sort to use ElementAt with bounds check while sorting. r=xpcom-reviewers,nika
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch

(In reply to Pulsebot from comment #4)

Pushed by jstutte@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f4efdaac44d1
Avoid nsTArray<>::Sort to use ElementAt with bounds check while sorting.
r=xpcom-reviewers,nika

== Change summary for alert #42015 (as of Tue, 26 Mar 2024 08:21:37 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
0.16% installer size osx-cross 93,960,921.83 -> 93,812,125.75

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=42015

Keywords: perf-alert
Flags: needinfo?(jstutte)

(In reply to Alex Finder from comment #6)

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
0.16% installer size osx-cross 93,960,921.83 -> 93,812,125.75

It seems we had previously more code from inlined ElementAt with bounds check than we need now, at least on Mac. That confirms the patch does something. Nice.

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

Attachment

General

Created:
Updated:
Size: