Investigate array sorting performance on Speedometer 3
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
People
(Reporter: jandem, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [sp3])
Array sorting sometimes shows up in profiles. I instrumented the browser and got some counts for starting Firefox and running all of SP3 (so each test runs multiple times):
* ArrayNativeSort fast path: 22172 times
* len <= 1 fast path: 842 times
Actual sorting in self-hosted code under ArraySort:
* MergeSort => InsertionSort: 1400 times
* MergeSort: 926 times
Comparator calls from self-hosted code: 123417
The ArrayNativeSort
path succeeds when we don't have a comparator function (13822 times) but also handles a lot of trivial comparators we pattern match (8350 times).
The number of calls to ArraySort
that end up doing the sorting in self-hosted code (under MergeSort
) is pretty small, but we spend a fair amount of time there I think.
Updated•9 months ago
|
Reporter | ||
Comment 1•9 months ago
|
||
I think the next step would be to create a representative micro-benchmark for some of the calls on Speedometer 3.
Comment 2•9 months ago
|
||
There was recently a report about slow sort performance (maybe bug 1850079?), where V8 was faster compared to us because they have a fast-path for already sorted arrays. Maybe SP3 has similar patterns where sort
is called on (partially) sorted arrays?
Updated•9 months ago
|
Updated•9 months ago
|
Description
•