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. IndexOf
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser:
Firefox 147
Operating system:
Windows
Device Platform:
Desktop
Date tested:
6 months ago
String.indexOf
1267.7M/s
String.includes
1257.4M/s
RegEx.test
31.4M/s
String.match
15.9M/s
View exact numbers
Test name
Executions per second
✓
String.indexOf
1,267,748,480 Ops/sec
String.includes
1,257,394,560 Ops/sec
RegEx.test
31,394,680 Ops/sec
String.match
15,864,405 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.indexOf
string.indexOf("Hello");