Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Test URI for File Extension
Tests methods of checking for a specific file extension
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
Slice Negative
19.0M/s
Slice Positive
19.0M/s
EndsWith Negative
17.7M/s
EndsWith Positive
15.1M/s
Split Positive
10.6M/s
Split Negative
10.5M/s
View exact numbers
Test name
Executions per second
✓
Slice Negative
19,041,702 Ops/sec
Slice Positive
19,015,130 Ops/sec
EndsWith Negative
17,670,462 Ops/sec
EndsWith Positive
15,066,870 Ops/sec
Split Positive
10,572,381 Ops/sec
Split Negative
10,466,105 Ops/sec
Script Preparation code:
function checkUsingSplit(uri) { return uri.split('.').pop() === 'html'; } function checkUsingEndsWith(uri) { return uri.endsWith('.html'); } function checkUsingSlice(uri) { return uri.slice(-5) === '.html'; }
Tests:
Split Positive
checkUsingSplit('/example/path/index.html');
Split Negative
checkUsingSplit('/example/path/index');
EndsWith Positive
checkUsingEndsWith('/example/path/index.html');
EndsWith Negative
checkUsingEndsWith('/example/path/index');
Slice Positive
checkUsingSlice('/example/path/index.html');
Slice Negative
checkUsingSlice('/example/path/index');