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>
"use strict";
const globalConst1 = 1;
const globalConstA = "a";
const globalConstO = {o:"o"};
let globalLet1 = 1;
let globalLetA = "a";
let globalLetO = {o:"o"};
var globalVar1 = 1;
var globalVarA = "a";
var globalVarO = {o:"o"};
function makeConstClosure(n) {
const value = n;
return function() {
return value;
}
}
var cc1 = makeConstClosure(1);
var cca = makeConstClosure("a");
var cco = makeConstClosure({o:"o"});
function makeLetClosure(n) {
let value = n;
return function() {
return value;
}
}
var lc1 = makeLetClosure(1);
var lca = makeLetClosure("a");
var lco = makeLetClosure({o:"o"});
function makeVarClosure(n) {
var value = n;
return function() {
return value;
}
}
var vc1 = makeVarClosure(1);
var vca = makeVarClosure("a");
var vco = makeVarClosure({o:"o"});
var gcc1 = function() {
return globalConst1;
};
var gcca = function() {
return globalConstA;
};
var gcco = function() {
return globalConstO;
};
var glc1 = function() {
return globalLet1;
};
var glca = function() {
return globalLetA;
};
var glco = function() {
return globalLetO;
};
var gvc1 = function() {
return globalVar1;
};
var gvca = function() {
return globalVarA;
};
var gvco = function() {
return globalVarO;
};
var count = 5000;
</script>Ready to run.
| Test | Ops/sec | |
|---|---|---|
| const | | ready |
| let | | ready |
| global const | | ready |
| global let | | ready |
| var | | ready |
| global var | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.