sort by ISO date

Benchmark created on


Setup

const arr = Array.from({ length: 1000 }, () => new Date(Math.random() * 20602494129 + 1735689600000).toISOString());

Test runner

Ready to run.

Testing in
TestOps/sec
new Date().getTime()
Array.from(arr).sort((a, b) => new Date(b).getTime() - new Date(a).getTime());
ready
new Date().valueOf()
Array.from(arr).sort((a, b) => new Date(b).valueOf() - new Date(a).valueOf());
ready
String.prototype.localeCompare()
Array.from(arr).sort((a, b) => b.localeCompare(a));
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.