Proxy JS Get Benchmark Multiple InheritanceFix4
Date tested:
3 months ago
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Test name
Executions per second
o1
28827340.0 Ops/sec
o2
28422340.0 Ops/sec
Proxy
20456200.0 Ops/sec
Benchmark definition (click to collapse):
Script Preparation code:
function multiInherit (p1,p2) { return Object.create(new Proxy(Object.create(null), { get (target, prop, receiver) { return p1[prop] || p2[prop] } })); } var o1 = {value:1} var o2 = {value2:2} var obj = multiInherit(o1, o2);
Tests:
o1
o1.value;
o2
o2.value
Proxy
obj.value2
Open this result on MeasureThat.net