Test name | Executions per second |
---|---|
test1 | 11284150.0 Ops/sec |
test2 | 399979.7 Ops/sec |
test3 | 36674316.0 Ops/sec |
test4 | 1409040.4 Ops/sec |
test5 | 50850840.0 Ops/sec |
test6 | 4118291.5 Ops/sec |
test7 | 465188.4 Ops/sec |
<script>
function fn1() {
const a = new Object();
a.val1 = 1;
a.val2 = 2;
a.f0 = () => a.val1 + a.val2;
return a;
}
function fn2() {
const a = new Function();
a.val1 = 1;
a.val2 = 2;
a.f0 = () => a.val1 + a.val2;
return a;
}
const f0 = function() {
console.log(this.val1 + this.val2);
};
function fn3() {
const a = {};
let f1 = f0.bind(a);
a.val1 = 1;
a.val2 = 2;
return f1;
}
class BB {
get name() {
return 'hi'
}
}
const BBp = BB.prototype;
BBp.val1 = 1;
BBp.val2 = 2;
function fn4() {
const a = () => {};
Object.setPrototypeOf(a, BBp);
return a;
}
function fn5() {
const a = () => {};
a.prototype = BBp;
return a;
}
let m = new Float64Array(256);
function fn6() {
const a = {};
a.b = m.subarray(0, 64);
return a;
}
function fn7() {
const a = {};
Object.defineProperty(a, 'b', {get: ()=> m.subarray(0, 64)})
return a;
}
</script>
fn1();fn1();fn1();fn1();fn1();fn1();fn1();fn1();fn1();fn1();
fn2();fn2();fn2();fn2();fn2();fn2();fn2();fn2();fn2();fn2();
fn3();fn3();fn3();fn3();fn3();fn3();fn3();fn3();fn3();fn3();
fn4();fn4();fn4();fn4();fn4();fn4();fn4();fn4();fn4();fn4();
fn5();fn5();fn5();fn5();fn5();fn5();fn5();fn5();fn5();fn5();
fn6();fn6();fn6();fn6();fn6();fn6();fn6();fn6();fn6();fn6();
fn7();fn7();fn7();fn7();fn7();fn7();fn7();fn7();fn7();fn7();