Test name | Executions per second |
---|---|
Array.sort() | 147144.2 Ops/sec |
Array.toSorted() | 0.0 Ops/sec |
[...Array].sort() | 65389.5 Ops/sec |
array = Array.from({
length: 50
}, (x, i) => (Math.round(Math.random() * (i + .01) * 1000)))
sortNumeric = (a, b) => (Number(a) - Number(b));
array.sort(sortNumeric);
array.toSorted(sortNumeric)
[array].sort(sortNumeric);