Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
cached Number.toLocaleString vs Intl.NumberFormat vs Regex
(version: 1)
Comparing performance of:
Intl.NumberFormat vs Number.toLocaleString vs Regex
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
const formatter = new Intl.NumberFormat(undefined, { style: 'currency', currency: 'RUB', });
Tests:
Intl.NumberFormat
const currencyPlayNumber = 1; const translatedString = formatter.format(currencyPlayNumber);
Number.toLocaleString
const currencyPlayNumber = 1; const translatedString = currencyPlayNumber.toLocaleString(undefined, { style: 'currency', currency: 'RUB', })
Regex
const currencyPlayNumber = 1; const translatedString = `${currencyPlayNumber}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Intl.NumberFormat
Number.toLocaleString
Regex
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser/OS:
Chrome 135 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Intl.NumberFormat
3910005.2 Ops/sec
Number.toLocaleString
61806.2 Ops/sec
Regex
34553468.0 Ops/sec
Related benchmarks:
Number.toLocaleString vs Intl.NumberFormat
Number.toLocaleString vs Intl.NumberFormat vs Regex
Number.toLocaleString vs Intl.NumberFormat (prepared)
Number.toLocaleString vs Intl.NumberFormat 2
test international
Number.toLocaleString vs Intl.NumberFormat memory pressure
Number.toLocaleString vs Intl.NumberFormat vs Regex2515
Number.toLocaleString vs Intl.NumberFormat (single instance)
Number.toLocaleString vs Intl.NumberFormat - random numbers
Comments
Confirm delete:
Do you really want to delete benchmark?