Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Find substring in a long string
Benchmark finding a string in a substring via several methods.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
Browser:
Firefox 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
IndexOf
2422.4M/s
Includes
2285.5M/s
test (regex)
41.4M/s
View exact numbers
Test name
Executions per second
✓
IndexOf
2,422,363,136 Ops/sec
Includes
2,285,458,176 Ops/sec
test (regex)
41,369,332 Ops/sec
Script Preparation code:
var string = 'test:segment:foo-bar:EBAC7R$MTVEQV3$GWF2WF2-2025@20240902:lorem-ipsum:v1:85136c79cbf9fe36bb9d05d0639c70c265c18d37'
Tests:
IndexOf
string.indexOf(':foo-bar:')
Includes
string.includes(':foo-bar:')
test (regex)
pattern = /:foo-bar:/ pattern.test(string)