Test name | Executions per second |
---|---|
new EmptyClass | 186718672.0 Ops/sec |
Object.create(EmptyClass); | 66215348.0 Ops/sec |
<script>
// Define the EmptyClass
class EmptyClass {
EmptyClass(a, b) {
this.a = a;
this.b = b;
}
}
var resulting = {
instance: null
};
</script>
const instance = new EmptyClass(1,2);
resulting.instance = instance;
const instance = Object.create(EmptyClass);
instance.a = 1;
instance.b = 2;
resulting.instance = instance;