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
Investigating the performance hit caused by nested functions.
var Closure = (function() {
var store;
function inner(a) {
store = a;
};
return {
Nested: function(a) {
function inner(a) {
store = a;
};
inner(a);
},
Unnested: function(a) {
inner(a)
}
}
})();
var flat;
function Nested(a) {
function inner(a) {
flat = a;
};
inner(a);
};
function Unnested(a) {
inner(a);
}
function inner(a) {
flat = a;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Nested inside Closure |
| ready |
Unnested inside Closure |
| ready |
Nested |
| ready |
Unnested |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.