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
class CPrivate {
#pri0 = 0
#pri1 = 1
#pri2 = 2
#pri3 = 3
#pri4 = 4
#pri5 = 5
#pri6 = 6
#pri7 = 7
#pri8 = 8
#pri9 = 9
sum() {
this.#pri0++
return this.#pri0 + this.#pri1 + this.#pri2 + this.#pri3 + this.#pri4 + this.#pri5 + this.#pri6 + this.#pri7 + this.#pri8 + this.#pri9
}
}
class CPublic {
pub0 = 0
pub1 = 1
pub2 = 2
pub3 = 3
pub4 = 4
pub5 = 5
pub6 = 6
pub7 = 7
pub8 = 8
pub9 = 9
sum() {
this.pub0++
return this.pub0 + this.pub1 + this.pub2 + this.pub3 + this.pub4 + this.pub5 + this.pub6 + this.pub7 + this.pub8 + this.pub9
}
}
class CConstructor {
constructor() {
this.pub0 = 0
this.pub1 = 1
this.pub2 = 2
this.pub3 = 3
this.pub4 = 4
this.pub5 = 5
this.pub6 = 6
this.pub7 = 7
this.pub8 = 8
this.pub9 = 9
}
sum() {
this.pub0++
return this.pub0 + this.pub1 + this.pub2 + this.pub3 + this.pub4 + this.pub5 + this.pub6 + this.pub7 + this.pub8 + this.pub9
}
}
var c_private = new CPrivate();
var c_public = new CPublic();
var c_constructor = new CConstructor();
var output
Ready to run.
| Test | Ops/sec | |
|---|---|---|
| private field | | ready |
| public field | | ready |
| pub in constructor | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.