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 (Windows NT 10.0; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
cached Intl.DateTimeFormat.format()
268K/s
cached Intl.DateTimeFormat.formatToParts()
139K/s
new Intl.DateTimeFormat.format()
10K/s
new Intl.DateTimeFormat.formatToParts
8K/s
View exact numbers
Test name
Executions per second
✓
cached Intl.DateTimeFormat.format()
268,011 Ops/sec
cached Intl.DateTimeFormat.formatToParts()
138,949 Ops/sec
new Intl.DateTimeFormat.format()
9,931 Ops/sec
new Intl.DateTimeFormat.formatToParts
8,494 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());