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 Component {
constructor() {
this.value = 0;
}
update() {
this.value = this.value + 1;
}
}
class Entity {
constructor(id) {
this.id = id;
this._components = [];
}
addComponent(component) {
this._components.push(component);
}
update() {
this._components.forEach((component) => {
component.update();
});
}
}
class ClassComponentSystem {
constructor() {
this._components = [];
}
add(component) {
this._components.push(component);
}
update() {
this._components.forEach((component) => {
component.update();
});
}
}
class PlainObjectComponentSystem {
constructor() {
this._components = [];
}
add(component) {
this._components.push(component);
}
update() {
this._components.forEach((component) => {
component.value = component.value + 1;
});
}
}
const entities = [],
classSystem = new ClassComponentSystem(),
plainObjectSystem = new PlainObjectComponentSystem();
Ready to run.
Test | Ops/sec | |
---|---|---|
Array of entities |
| ready |
Class-based component system |
| ready |
Plain object component system |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.