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
fixed bug in raynos. tried to make it faster. tried closure compiler version
<script>
Function.prototype.bindRaynos = function (context) {
var f = this;
var curriedArgs = Array.prototype.slice.call(arguments, 1);
if (curriedArgs.length) {
return function () {
var allArgs = curriedArgs.slice(0);
for (var i = 0, n = arguments.length; i < n; ++i) {
allArgs.push(arguments[i]);
}
return f.apply(context, allArgs);
};
} else {
return createProxy(f, context);
}
};
function createProxy(f, context) {
return function () {
return f.apply(context, arguments);
}
}
Function.prototype.bindRaynos2 = function (context) {
var f = this;
var curriedArgs = Array.prototype.slice.call(arguments, 1);
if (curriedArgs.length) {
return function () {
var allArgs = curriedArgs.slice(0);
for (var i = 0, n = arguments.length; i < n; ++i) {
allArgs.push(arguments[i]);
}
return f.apply(context, allArgs);
};
} else {
return createProxy(f, context);
}
function createProxy(f, context) {
return function () {
return f.apply(context, arguments);
}
}
};
Function.prototype.bindClosure=function(d){function c(b,a){return function(){return b.apply(a,arguments)}}var e=this,f=Array.prototype.slice.call(arguments,1);return f.length?function(){for(var b=f.slice(0),a=0,c=arguments.length;a<c;++a)b.push(arguments[a]);return e.apply(d,b)}:c(e,d)};
var i = {};
var f = function () {
return this.i = Array.prototype.slice.call(arguments, 0).join(',');
};
var nativelyBound = f.bind(i);
var nativelyBoundArgs = f.bind(i, 'xxx');
var raynosBound = f.bindRaynos(i);
var raynosBoundArgs = f.bindRaynos(i, 'xxx');
var raynos2Bound = f.bindRaynos2(i);
var raynos2BoundArgs = f.bindRaynos2(i, 'xxx');
var closureBound = f.bindClosure(i);
var closureBoundArgs = f.bindClosure(i, 'xxx');
console.assert(nativelyBound() === '');
console.assert(nativelyBoundArgs() === 'xxx');
console.assert(nativelyBound('xyz') === 'xyz');
console.assert(nativelyBoundArgs('xyz') === 'xxx,xyz');
console.assert(raynosBound() === '');
console.assert(raynosBoundArgs() === 'xxx');
console.assert(raynosBound('xyz') === 'xyz');
console.assert(raynosBoundArgs('xyz') === 'xxx,xyz');
console.assert(raynos2Bound() === '');
console.assert(raynos2BoundArgs() === 'xxx');
console.assert(raynos2Bound('xyz') === 'xyz');
console.assert(raynos2BoundArgs('xyz') === 'xxx,xyz');
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Native version |
| ready |
Raynos's version |
| ready |
Raynos 2 |
| ready |
raynos's version closure compiler vanced |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.