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>
Array.fy = (function() {
// © WebReflection — MIT-style license
for (var
m = [
'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift',
'concat', 'join', 'slice', 'indexOf', 'lastIndexOf',
'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight'
],
i = m.length;
i--;
) {
m[i] = 'o.' + m[i] + '=p.' + m[i];
}
m.push('return o');
return Function('p',
'return function Arrayfy(o){' + m.join(';') + '}'
)(Array.prototype);
}());
var slice = Array.prototype.slice,
args = [1, 2, 3, 4, 5],
fy = Array.fy,
forEach = Array.prototype.forEach,
forEachGeneric = Array.forEach,
callback = function() { };
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Array.fy(arguments).forEach |
| ready |
slice.call(arguments).forEach |
| ready |
arguments.__proto__ = Array.prototype; arguments.forEach |
| ready |
Array.prototype.forEach.call(arguments) |
| ready |
Array.apply(null, arguments).forEach |
| ready |
Array.forEach(arguments) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.