Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Performance checking the start of a string
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:143.0) Gecko/20100101 Firefox/143.0
Browser:
Firefox 143
Operating system:
Windows
Device Platform:
Desktop
Date tested:
8 months ago
startsWith
2147.2M/s
Indexed
2093.3M/s
regex
38.5M/s
View exact numbers
Test name
Executions per second
✓
startsWith
2,147,175,680 Ops/sec
Indexed
2,093,255,552 Ops/sec
regex
38,478,584 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Tests:
Indexed
const subject = '--foo'; subject[0] === '-' && subject[1] === '-' && subject.length > 2 && subject[2] !== '-';
startsWith
const subject = '--foo'; subject.startsWith('--') && subject.length > 2 && subject[2] !== '-';
regex
const subject = '--foo'; const pattern = /^--[^-]/; subject.match(pattern);