Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
checkUrl protocol indexOf vs RegExp
(version: 2)
Comparing performance of:
if vs regExp
Created:
one year ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
let value = { image: 'sdp://sad/asda/ddeeerr/path/path/sss/aasedd/t4/e3/2w/3w/45d/', source: '' }
Tests:
if
if (value.image.indexOf('skin://') === 0) { value.image = value.image.replace('skin://', ''); value.source = 'skin'; } if (value.image.indexOf('config://') === 0) { value.image = value.image.replace('config://', ''); value.source = 'config'; } if (value.image.indexOf('sdp://') === 0) { value.image = value.image.replace('sdp://', ''); value.source = 'sdp'; }
regExp
value.image.replace(/^(skin|config|sdp):\/\//, (s1, s2) => { value.source = s2; return '' });
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
if
regExp
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser/OS:
Chrome 132 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
if
9244236.0 Ops/sec
regExp
16112942.0 Ops/sec
Related benchmarks:
RegexvsIndexOfvZ
Test URLS/Regex Loop
파인랩3ㄹ회
jjasdasdasd
JS > exec vs matchAll vs match
URL parsing and matching
Regex Memory Consumption
fynd test
JS regexp
Comments
Confirm delete:
Do you really want to delete benchmark?