Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Substring in a string: IndexOf vs Includes vs lodash includes
Testing for the speed of finding a substring in a string.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:131.0) Gecko/20100101 Firefox/131.0
Browser:
Firefox 131
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
IndexOf
1562.5M/s
Includes
1558.2M/s
lodash
35.5M/s
View exact numbers
Test name
Executions per second
✓
IndexOf
1,562,450,816 Ops/sec
Includes
1,558,164,736 Ops/sec
lodash
35,513,388 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
var text = "1KX5 P/CKD TORTELLINI BRAIS BEEF CA CT 631 ***** note: we don't sell this. *****";
Tests:
IndexOf
text.indexOf('note') !== 1
Includes
text.includes('note')
lodash
_.includes(text, 'note')