Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
string.includes vs string.indexOf vs regex.test(string) vs == vs ===
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1.1 Safari/605.1.15
Browser:
Safari 18
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
Equal
535.0M/s
Strict Equal
470.1M/s
regex
424.3M/s
indexOf
380.3M/s
includes
11.7M/s
View exact numbers
Test name
Executions per second
✓
Equal
535,005,024 Ops/sec
Strict Equal
470,092,128 Ops/sec
regex
424,270,048 Ops/sec
indexOf
380,344,416 Ops/sec
includes
11,725,476 Ops/sec
Script Preparation code:
var string = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'
Tests:
indexOf
string.indexOf('ullamco')
includes
string.includes('ullamco')
regex
/ullamco/.test(string)
Equal
string == 'ullamco'
Strict Equal
string === 'ullamco'