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
(function() {
var slice = [].slice;
function bind1(thisArg) {
var fn = this,
args = (arguments.length > 1) ? slice.call(arguments, 1) : null;
return function() {
var length = arguments.length;
return (!args && !length)
? fn.call(thisArg)
: fn.apply(thisArg, args && length ? args.concat(slice.call(arguments)) : args || arguments);
};
}
function bind2(thisArg) {
var fn = this,
args = arguments.length > 1 ? slice.call(arguments, 1) : null;
function F() { }
function bound(){
var result,
context = thisArg,
length = arguments.length;
if (this instanceof bound){
F.prototype = fn.prototype;
context = new F;
}
result = (!args && !length)
? fn.call(context)
: fn.apply(context, args && length ? args.concat(slice.call(arguments)) : args || arguments);
return context == thisArg ? result : context;
}
return bound;
}
Function.prototype.bind1 = bind1;
Function.prototype.bind2 = bind2;
}());
Benchmark.prototype.setup = function() {
var fn = function(type) {
this.type = type;
};
var obj = {
'type': 'bar'
};
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Native |
| ready |
Old |
| ready |
New |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.