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 (X11; Ubuntu; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0
Browser:
Firefox 136
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
9 months ago
string.indexOf()
909.8M/s
text.includes()
903.7M/s
regex.test()
23.0M/s
string.match()
13.2M/s
View exact numbers
Test name
Executions per second
✓
string.indexOf()
909,759,488 Ops/sec
text.includes()
903,737,472 Ops/sec
regex.test()
22,967,916 Ops/sec
string.match()
13,198,304 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