Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
native string replaceAll vs regex replace
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36 Edg/147.0.0.0
Browser:
Chrome 147
Operating system:
Windows
Device Platform:
Desktop
Date tested:
3 months ago
replace
5.9M/s
replaceAll
5.2M/s
replaceAll (regex)
4.0M/s
View exact numbers
Test name
Executions per second
✓
replace
5,932,414 Ops/sec
replaceAll
5,227,379 Ops/sec
replaceAll (regex)
4,031,235 Ops/sec
Tests:
replaceAll
"this is it".replaceAll(" ", "+");
replace
"this is it".replace(/ /g, "+");
replaceAll (regex)
"this is it".replaceAll(/ /g, "+");