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/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
=== known length
202.1M/s
String.includes
188.2M/s
==
182.6M/s
startsWith
103.6M/s
RegEx.test
50.5M/s
String.match
9.5M/s
View exact numbers
Test name
Executions per second
✓
=== known length
202,069,824 Ops/sec
String.includes
188,173,616 Ops/sec
==
182,596,272 Ops/sec
startsWith
103,615,336 Ops/sec
RegEx.test
50,465,844 Ops/sec
String.match
9,544,587 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")