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
let myClassObject;
let myFuncObject1;
let myFuncObject2;
// using the `class` keyword
class MyClassObject {
constructor(initVal) {
this.myVal = initVal;
}
set(x) {
this.myVal = x;
}
}
// using a function with `this`
const makeObject1 = initVal => {
return {
myVal: initVal,
set: function(x) {
this.myVal = x;
},
};
};
// using a function without `this`
const makeObject2 = initVal => {
let myVal = initVal;
return {
get: function() {
return myVal;
},
set: function(val) {
myVal = val;
},
};
};
delete myClassObject;
delete myFuncObject1;
delete myFuncObject2;
Ready to run.
Test | Ops/sec | |
---|---|---|
ES2015 Classes |
| ready |
Function with this |
| ready |
Function without this |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.