Testing date sorts

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Date.parse
const dates = ['01/01/2021', '01/01/2022', '01/01/2023'];

console.log(dates.sort((a, b) => Date.parse(b) - Date.parse(a)))
ready
String compare
const dates = ['01/01/2021', '01/01/2022', '01/01/2023'];

console.log(dates.sort((a, b) => a > b ? -1 : a < b ? 1 : 0));
ready
new Date
const dates = ['01/01/2021', '01/01/2022', '01/01/2023'];

console.log(dates.sort((a, b) => new Date(b) - new Date(a)))
ready

Revisions

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