Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
String.replace vs String.replaceAll
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0
Browser:
Firefox 126
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Regex replace in place
7006335.0 Ops/sec
Regex replace stored in variable
6957298.5 Ops/sec
String replaceAll
16183910.0 Ops/sec
Tests:
Regex replace in place
"this is it".replace(/ /g, "+");
Regex replace stored in variable
var token = / /g; "this is it".replace(token, "+");
String replaceAll
"this is it".replaceAll(" ", "+");