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 _fn = [],
_args = []
_fn.push(function() {
return
})
_args.push([])
_fn.push(function(a) {
return a
})
_args.push(['a'])
_fn.push(function(a, b) {
return a + b
})
_args.push(['a', 'b'])
_fn.push(function(a, b, c) {
return a + b + c
})
_args.push(['a', 'b', 'c'])
_fn.push(function(a, b, c, d) {
return a + b + c + d
})
_args.push(['a', 'b', 'c', 'd'])
_fn.push(function(a, b, c, d, e) {
return a + b + c + d + e
})
_args.push(['a', 'b', 'c', 'd', 'e'])
_fn.push(function(a, b, c, d, e, f) {
return a + b + c + d + e + f
})
_args.push(['a', 'b', 'c', 'd', 'e', 'f'])
_fn.push(function(a, b, c, d, e, f, g) {
return a + b + c + d + e + f + g
})
_args.push(['a', 'b', 'c', 'd', 'e', 'f', 'g'])
_fn.push(function(a, b, c, d, e, f, g, h) {
return a + b + c + d + e + f + g + h
})
_args.push(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'])
_fn.push(function(a, b, c, d, e, f, g, h, i) {
return a + b + c + d + e + f + g + h + i
})
_args.push(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
_fn.push(function(a, b, c, d, e, f, g, h, i, j) {
return a + b + c + d + e + f + g + h + i + j
})
_args.push(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'])
_fn.push(function(a, b, c, d, e, f, g, h, i, j, k) {
return a + b + c + d + e + f + g + h + i + j + k
})
_args.push(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'])
var fn, args;
function chooseRandomFn() {
var num = ~~ (Math.random() * _fn.length);
fn = _fn[num];
args = _args[num];
}
// These fns were generated with code, because I'm lazy. But eval'ed code doesn't get optimized like normal code, so you'll have to run this code somewhere and copy it in place.
// console.log("var _fn = [], _args = []")
// for( var i = 0; i <= 11; i++ ){
// var args = [];
// var vals = [];
// for( var argN = 0; argN < i; argN++ ){
// var c = String.fromCharCode(97 + argN)
// args.push( c )
// vals.push( "'" + c + "'" )
// }
// console.log( "_fn.push( function (" + args.join(',') + "){ return " + args.join('+') + " } )" )
// console.log( "_args.push( [" + vals.join(',') + "] )" )
// }
Ready to run.
Test | Ops/sec | |
---|---|---|
apply |
| ready |
switch |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.