Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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:155.0) Gecko/20100101 Firefox/155.0
Browser:
Firefox 155
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
15 hours ago
Benchmark engine:
Benchmark.js
toSorted
21.6M/s
sort
21.0M/s
View exact numbers
Test name
Executions per second
✓
toSorted
21,636,216 Ops/sec
sort
21,049,988 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)