Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Sort vs ToSorted
test
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:151.0) Gecko/20100101 Firefox/151.0
Browser:
Firefox 151
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
3 months ago
toSorted
13.1M/s
sort
12.7M/s
View exact numbers
Test name
Executions per second
✓
toSorted
13,061,171 Ops/sec
sort
12,672,471 Ops/sec
Script Preparation code:
const element = [{foo: 100}, {foo:200}, {foo: 50}]
Tests:
sort
const element = [{foo: 100}, {foo:200}, {foo: 50}] const result = [...element].sort((a,b) => a.foo - b.foo)
toSorted
const element = [{foo: 100}, {foo:200}, {foo: 50}] const result = element.toSorted((a,b) => a.foo - b.foo)