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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Includes
261.3M/s
IndexOf
246.1M/s
test (regex)
12.0M/s
View exact numbers
Test name
Executions per second
✓
Includes
261,331,056 Ops/sec
IndexOf
246,082,672 Ops/sec
test (regex)
12,009,336 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)