Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
[...array].sort vs array.toSorted
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_3_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/132.0.6834.100 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 132
Operating system:
iOS 18.3.0
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
[...array].sort
827.4 Ops/sec
array.toSorted
801.7 Ops/sec
Script Preparation code:
var array = Array.from({ length: 10_000 }).map((_) => Math.random()); var compareFn = (a, b) => a - b
Tests:
[...array].sort
const result = [...array].sort(compareFn);
array.toSorted
const result = array.toSorted(compareFn)