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 autoCurry = (function () {
var toArray = function toArray(arr, from) {
return Array.prototype.slice.call(arr, from || 0);
},
curry = function curry(fn /* variadic number of args */) {
var args = toArray(arguments, 1);
return function curried() {
return fn.apply(this, args.concat(toArray(arguments)));
};
};
return function autoCurry(fn, numArgs) {
numArgs = numArgs || fn.length;
return function autoCurried() {
if (arguments.length < numArgs) {
return numArgs - arguments.length > 0 ?
autoCurry(curry.apply(this, [fn].concat(toArray(arguments))),
numArgs - arguments.length) :
curry.apply(this, [fn].concat(toArray(arguments)));
}
else {
return fn.apply(this, arguments);
}
};
};
}());
var testFn = function(a, b, c) {
return a + b + c;
}
var autoFn = autoCurry(testFn);
Ready to run.
Test | Ops/sec | |
---|---|---|
benchmark |
| ready |
auto curry |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.