Open Bug 1855968 Opened 9 months ago Updated 3 months ago

Investigate array sorting performance on Speedometer 3

Categories

(Core :: JavaScript Engine, task, P3)

task

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.

I think the next step would be to create a representative micro-benchmark for some of the calls on Speedometer 3.

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?

See Also: → 1810275, 1821840
Severity: -- → S3
Priority: -- → P3
Depends on: 1858679
See Also: → 1884360
See Also: → 1850079
Depends on: 1889685
You need to log in before you can comment on or make changes to this bug.