Date formatting benchmark (v3)

Revision 3 of this benchmark created on


Setup

const format =  {
    weekday: 'long',
    month: 'long',
    day: '2-digit',
};
const now = new Date();

const sharedDateTimeFormat = new Intl.DateTimeFormat('en-US', format);

const sharedDateTimeZeroFormat = new Intl.DateTimeFormat('en-US');

Test runner

Ready to run.

Testing in
TestOps/sec
Intl.DateTimeFormat with formatting
const dateTimeFormat = new Intl.DateTimeFormat('en-US', format);
dateTimeFormat.format(now);
ready
toLocaleTimeString with formatting
now.toLocaleTimeString('en-US', format)
ready
Intl.DateTimeFormat reused with formatting
sharedDateTimeFormat.format(now);
ready
toLocaleTimeString no formatting
now.toLocaleTimeString('en-US')
ready
Intl.DateTimeFormat reused no formatting
sharedDateTimeZeroFormat.format(now)
ready

Revisions

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