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 GameObject {
constructor () {
this.position = {
x: Math.random(),
y: Math.random(),
z: Math.random(),
}
this.velocity = {
x: Math.random(),
y: Math.random(),
z: Math.random(),
}
}
}
const gameObjects = new Array(1000).fill(0).map(() => new GameObject());
// ------
const positionBuffer = new Array(1000).fill(0).map(() => [Math.random(), Math.random(), Math.random()]).flat();
const velocityBuffer = new Array(1000).fill(0).map(() => [Math.random(), Math.random(), Math.random()]).flat();
const massBuffer = new Array(3000).fill(0).map(() => Math.random())
// -----
class Polluted_GameObject {
constructor () {
this.position = {
x: Math.random(),
y: Math.random(),
z: Math.random(),
}
this.velocity = {
x: Math.random(),
y: Math.random(),
z: Math.random(),
}
this.a = Math.random();
this.b = Math.random();
this.c = Math.random();
this.d = Math.random();
this.e = Math.random();
this.f = Math.random();
this.g = Math.random();
this.h = Math.random();
this.s1 = "sdfsdfsdfsdfsdfsdf";
this.s2 = "sdfsdfsdfsdfsdfsdf";
this.s3 = "sdfsdfsdfsdfsdfsdf";
this.s4 = "sdfsdfsdfsdfsdfsdf";
this.s5 = "sdfsdfsdfsdfsdfsdf";
this.arr = new Array(100).fill(0).map(() => Math.random());
this.arr2 = new Array(100).fill(0).map(() => Math.random());
this.arr3 = new Array(100).fill(0).map(() => Math.random());
}
}
const p_gameObjects = new Array(1000).fill(0).map(() => new Polluted_GameObject());
Ready to run.
Test | Ops/sec | |
---|---|---|
obj |
| ready |
buffer |
| ready |
polluted gameobject |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.