Date formatting benchmark

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Intl
const format =  {
    weekday: 'long',
    month: 'long',
    day: '2-digit',
};
const dateTimeFormat = new Intl.DateTimeFormat('en', format);
const start1 = performance.now();
for (let i = 0; i < 10000; i++) dateTimeFormat.format(new Date());
console.log('re-use Intl.DateTimeFormat', performance.now() - start1);
ready
Tolocalestring
const format =  {
    weekday: 'long',
    month: 'long',
    day: '2-digit',
};

const start2 = performance.now();
for (let i = 0; i < 10000; i++) new Date().toLocaleString('en', format);
console.log('use toLocaleString', performance.now() - start2);
ready

Revisions

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