Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
RegEx.test vs. String.includes vs. String.match vs String.replace vs String.replace classic
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/121.0.0.0 Safari/537.36 OPR/107.0.0.0
Browser:
Opera 107
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
String.includes
20.6M/s
String.replace classic
12.2M/s
RegEx.test
9.1M/s
String.replace
6.7M/s
String.match
5.3M/s
View exact numbers
Test name
Executions per second
✓
String.includes
20,649,196 Ops/sec
String.replace classic
12,183,250 Ops/sec
RegEx.test
9,100,628 Ops/sec
String.replace
6,748,448 Ops/sec
String.match
5,290,786 Ops/sec
Script Preparation code:
var string = "Hello world!"; var regex = /Hello/;
Tests:
RegEx.test
regex.test(string);
String.includes
string.includes("Hello");
String.match
string.match("Hello");
String.replace
string.replace(regex, 'test')
String.replace classic
string.replace('Hello', 'test')