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:
one month ago
Test name
Executions per second
Intl.NumberFormat
58125.3 Ops/sec
toLocalString
59794.7 Ops/sec
Custom Formatter
172110176.0 Ops/sec
Pre-created Intl formatter
2750228.2 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");