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 == .slice
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/137.0.0.0 Safari/537.36
Browser:
Chrome 137
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
=== known length
229.3M/s
String.includes
222.4M/s
==
207.6M/s
startsWith
103.7M/s
RegEx.test
57.6M/s
String.match
9.9M/s
View exact numbers
Test name
Executions per second
✓
=== known length
229,311,952 Ops/sec
String.includes
222,374,576 Ops/sec
==
207,556,336 Ops/sec
startsWith
103,727,864 Ops/sec
RegEx.test
57,618,296 Ops/sec
String.match
9,888,966 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");
==
"Hello" == string.slice(0, "Hello".length);
=== known length
string.slice(0, 5) === "Hello"
startsWith
string.startsWith("Hello")