Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
new Intl.DateTimeFormat vs cached Intl.DateTimeFormat
measure the perf impact of caching calls to new Intl.DateTimeFormat
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser:
Chrome 136
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
cached Intl.DateTimeFormat.format()
1.1M/s
cached Intl.DateTimeFormat.formatToParts()
533K/s
new Intl.DateTimeFormat.format()
40K/s
new Intl.DateTimeFormat.formatToParts
39K/s
View exact numbers
Test name
Executions per second
✓
cached Intl.DateTimeFormat.format()
1,123,814 Ops/sec
cached Intl.DateTimeFormat.formatToParts()
532,962 Ops/sec
new Intl.DateTimeFormat.format()
39,810 Ops/sec
new Intl.DateTimeFormat.formatToParts
38,873 Ops/sec
Script Preparation code:
const TWO_DIGIT = '2-digit'; var options = { month: TWO_DIGIT, year: 'numeric', day: TWO_DIGIT, hour: TWO_DIGIT, hour12: false, minute: TWO_DIGIT, second: TWO_DIGIT, } var cached = new Intl.DateTimeFormat('en-US', options);
Tests:
new Intl.DateTimeFormat.format()
new Intl.DateTimeFormat('en-US', options).format(new Date());
cached Intl.DateTimeFormat.format()
cached.format(new Date());
new Intl.DateTimeFormat.formatToParts
new Intl.DateTimeFormat('en-US', options).formatToParts(new Date());
cached Intl.DateTimeFormat.formatToParts()
cached.formatToParts(new Date());