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>
function memoize1(func) {
"use strict";
var cache={},
stringifyJson = JSON.stringify,
sliceArray = Array.prototype.slice,
u;
return function() {
var hash = stringifyJson(sliceArray.call(arguments));
var foo=cache[hash];
return foo===u?cache[hash]=func.apply(this, arguments):foo;
};
};
function memoize2(func) {
"use strict";
var cache=new Uint32Array,
stringifyJson = JSON.stringify,
sliceArray = Array.prototype.slice,
u;
return function(a) {
var u,foo=cache[a];
return foo===u?cache[a]=func(a):foo;
};
};
var fib1, fib2, fiborg;
fiborg = function f(x) {
if(x < 2) return 1; else return f(x-1) + f(x-2);
}
fib1=memoize1(fiborg);
fib2=memoize2(fiborg);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
1 |
| ready |
2 |
| ready |
org |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.