jeromeetienne / threex.htmlmixer

three.js extension to seemlessly integrate dom elements in your webgl

Home Page:http://jeromeetienne.github.io/threex.htmlmixer/examples/demo.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Store methods on prototype for better performance.

trusktr opened this issue · comments

this.update = function(){
updateFcts.forEach(function(updateFct){
updateFct()
})
}

Storing methods on the prototype instead of creating a new one for each constructor can perform better. Currently, if there's 100 planes, then there will be 100 instances of the update method (an instance of Function). But if you instead store update on the class prototype, then there will only every be one instance of the update method.

See this PR for more details.