xeolabs / scenejs

An extensible WebGL-based 3D engine. This is an archived project.
https://xeolabs.github.io/scenejs/
Other
649 stars 165 forks source link

Should node prototypes be modified? #432

Closed tsherif closed 8 years ago

tsherif commented 8 years ago

I'm not sure modifying the Node class' __proto__, as is done here, is a good idea. MDN suggests that this kind of update can have serious performance consequences.

xeolabs commented 8 years ago

Indeed it could. This would be one of the things I can fix up in the planned refactor. It's used to allow bulk update of properties via calls like someNode.set({ foo: "x", bar: "y" }), which I want to remove in the refactor, so I'll deal with it then.

Note that it will affect efficiency of updates to scene node properties, and won't affect the actual rendering speed.

tsherif commented 8 years ago

True. My main concern would be nodes that are updated frequently, e.g. xform nodes where you often have many of them getting updated per frame.

xeolabs commented 8 years ago

This only done in order to support batch-setting of node attributes via JSON objects, which is scheduled to be removed in v4.3.0.