Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
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
Test name
Executions per second
IndexOf
1562450816.0 Ops/sec
Includes
1558164736.0 Ops/sec
lodash
35513388.0 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')