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
EndsWith Negative
17.1M/s
EndsWith Positive
14.5M/s
Split Positive
10.1M/s
Split Negative
9.8M/s
View exact numbers
Test name
Executions per second
✓
EndsWith Negative
17,058,216 Ops/sec
EndsWith Positive
14,510,161 Ops/sec
Split Positive
10,081,897 Ops/sec
Split Negative
9,787,709 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');