Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
.includes() vs .test() vs .match() vs .indexOf() vs .search()
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:78.0) Gecko/20100101 Firefox/78.0
Browser:
Firefox 78
Operating system:
Mac OS X 10.11
Device Platform:
Desktop
Date tested:
one year ago
text.indexOf()
6.5M/s
text.includes()
6.0M/s
text.search()
4.4M/s
text.test()
3.3M/s
text.match()
1.6M/s
View exact numbers
Test name
Executions per second
✓
text.indexOf()
6,512,858 Ops/sec
text.includes()
6,003,972 Ops/sec
text.search()
4,380,614 Ops/sec
text.test()
3,337,803 Ops/sec
text.match()
1,557,890 Ops/sec
Script Preparation code:
var url = 'https://www.google.com/matchthis/other/args'
Tests:
text.includes()
url.includes('matchthis')
text.test()
/matchthis/.test(url)
text.match()
url.match(/matchthis/)
text.indexOf()
url.indexOf('matchthis') >= 0
text.search()
url.search('matchthis') >= 0