Avoid nsTArray<>::Sort to use ElementAt with bounds check while sorting
Categories
(Core :: XPCOM, enhancement)
Tracking
()
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.
Assignee | ||
Comment 1•8 months ago
|
||
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.
Updated•8 months ago
|
Comment 2•8 months ago
|
||
Is "whith" in the summary supposed to be "without"?
Assignee | ||
Comment 3•8 months ago
|
||
(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".
Updated•8 months ago
|
Comment 5•8 months ago
|
||
bugherder |
Comment 6•8 months ago
|
||
(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
Assignee | ||
Updated•8 months ago
|
Assignee | ||
Comment 7•8 months ago
|
||
(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.
Description
•