Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Intl.NumberFormat vs toLocalString vs Custom Format vs Pre-created Intl formatter
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Browser:
Chrome 146
Operating system:
Linux
Device Platform:
Desktop
Date tested:
4 months ago
Custom Formatter
172.1M/s
Pre-created Intl formatter
2.8M/s
toLocalString
60K/s
Intl.NumberFormat
58K/s
View exact numbers
Test name
Executions per second
✓
Custom Formatter
172,110,176 Ops/sec
Pre-created Intl formatter
2,750,228 Ops/sec
toLocalString
59,795 Ops/sec
Intl.NumberFormat
58,125 Ops/sec
Script Preparation code:
function formatUSD(a) { return '$' + a; } var formatIntlUSD = new Intl.NumberFormat("en-US", { style: 'currency', currency: 'USD' });
Tests:
Intl.NumberFormat
var a = new Intl.NumberFormat("en-US", { style: 'currency', currency: 'USD' }).format("10000");
toLocalString
var a = (10000).toLocaleString("en-US", { style: 'currency', currency: 'USD' });
Custom Formatter
var a = formatUSD("10000");
Pre-created Intl formatter
var a = formatIntlUSD.format("10000");