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
var values = [41, 73, 98, 62, 85, 51, 28, 89, 20];
var minReduce = function(arr) {
return arr.reduce(function(p, v) {
return (p < v ? p : v);
});
};
var maxReduce = function(arr) {
return arr.reduce(function(p, v) {
return (p > v ? p : v);
});
};
var minMath = function(arr) {
return Math.min.apply(null, arr);
};
var maxMath = function(arr) {
return Math.max.apply(null, arr);
};
var minLoop = function(arr) {
var len = arr.length,
min = Infinity;
while (len--) {
if (arr[len] < min) {
min = arr[len];
}
}
return min;
};
var maxLoop = function(arr) {
var len = arr.length,
max = -Infinity;
while (len--) {
if (arr[len] > max) {
max = arr[len];
}
}
return max;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Reduce |
| ready |
Math |
| ready |
Loop |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.