MDN values ββthat use .setPrototypeOf() will .setPrototypeOf() affect the future performance of your code.
I also read several Questions about why modifying the [[Prototype]] object reduces performance. But none of the answers explained what was happening in the background. So I wonder if this also applies to new objects.
In particular, I really like to do things like this:
var MyPrototype = { method1 : function(){...}, method2 : function(){...}, ... }; var newObject = Object.setPrototypeOf({ property : 1, property2 : 'text' }, MyPrototype);
Unfortunately, you cannot do this with Object.create , since it does not accept a literal of a simple object.
Is my use of setPrototypeOf also a performance degradation of the executable JS engine?
source share