Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131
Mac OS X 10.15.7
Desktop
one year ago
Benchmark.js
sort
5.6M/s
manual compare
3.3M/s
localcompare
2.5M/s
date convert to timestamp + sort (timezone safe)
482K/s
date convert to date + sort a-b (timezone safe)
297K/s
View exact numbers
Test name Executions per second
sort 5,573,752 Ops/sec
manual compare 3,262,929 Ops/sec
localcompare 2,489,764 Ops/sec
date convert to timestamp + sort (timezone safe) 481,802 Ops/sec
date convert to date + sort a-b (timezone safe) 297,492 Ops/sec
Script Preparation code:
Tests: