Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
.includes() vs .test() vs .match() vs .indexOf()
Compare different intra-string matching styles
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0
Browser:
Firefox 132
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
string.indexOf()
1596.4M/s
text.includes()
1581.0M/s
regex.test()
39.3M/s
string.match()
24.5M/s
View exact numbers
Test name
Executions per second
✓
string.indexOf()
1,596,443,136 Ops/sec
text.includes()
1,581,005,696 Ops/sec
regex.test()
39,311,760 Ops/sec
string.match()
24,463,558 Ops/sec
Script Preparation code:
var url='https://www.google.com/matchthis/other/args'
Tests:
text.includes()
url.includes('matchthis')
regex.test()
/matchthis/.test(url)
string.match()
url.match(/matchthis/)
string.indexOf()
url.indexOf('matchthis') >= 0