jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
<script>
function dirname(path) {
var s = path.split('/').slice(0, -1).join('/');
return s ? s : '.';
}
function dirname2(path) {
var s = ('./' + path).replace(/(.*)?\/.*/, '$1').substring(2);
return s ? s : '.';
}
function dirname3(path) {
var s = (path).match(/.*(?=\/.*$)/);
return (s ? s[0] : '.') + '/';
}
function dirname4(path) {
var i = path.lastIndexOf("/")
return i > -1 ? path.substring(0, i) : null[0];
}
var DIRNAME_RE = /[^?#]*\//
function dirname5(path) {
return path.match(DIRNAME_RE)[0];
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
split |
| ready |
regex |
| ready |
regex match |
| ready |
lastindexof |
| ready |
seaJS |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.