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
stevenbarragan = function(array) {
return array.length == 0 || array.length == 1 ? array : [].concat(
array.shift(),
array.map(function(_,i){return array[i].pop();}),
array.pop().reverse(),
array.map(function(_,i){return array[i].shift();}).reverse(),
stevenbarragan(array)
);
}
haan = function(n) {
var i_snail = function(n, x, y) {
var result = [];
for (var i = x; i <= y; i++) {
result.push(n[x][i]);
}
for (var i = x+1; i <= y; i++) {
result.push(n[i][y]);
}
for (var i = y-1; i >= x; i--) {
result.push(n[y][i]);
}
for (var i = y-1; i >= x+1; i--) {
result.push(n[i][x]);
}
if (x < y) {
return result.concat(i_snail(n, x+1, y-1));
} else {
return result;
}
}
return i_snail(n, 0, n[0].length - 1);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
stevenbarragan |
| ready |
haan |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.