Since your use case is an animation, you want to stick with closures. A simple rule of thumb with javascript is "the more . Is, the slower the code goes." In the examples you posted to jsperf, the slowest are the ones that reference this quite a bit. Everyone , when you do this, the engine should look at the current object and determine if what you are trying to access the object is accessible, and if it should look for a prototype chain, On the close side of things, you refer to a rather limited scope predefined by the function which you wrote, and most of all the engine should be able to look at this area in order to refer to the variables in it.
Now, there are some gotcha's. Firstly, using this much faster if you only reference it once or twice. Not in this case, but worth mentioning. The more times you add a link to this , the slower the prototype depends on the code. Take a look at this simple perf for an example. Secondly, if you build a lot of these modules (for example, if you build a data grid), the construction is incredibly slow with closing, and there is a lot of memory lost. See this example for speed differences. The more methods and properties you add, the worse it gets. This is because creating a new closure each time creates unique functions and properties, while the prototype is based only on reusing the same material.
In any case, my humble recommendation is just to look at the situation for which you are programming. In most cases, the use of prototypes is a way of reading (in some cases), reuse, extensibility. But if they are too slow, you simply cannot use them. However, there is nothing wrong with combining the two concepts to give you reusable and modular configuration for methods that do not fall so often. For example, try using "Mixins":
var Mixin = { interval: 100, finish: function () { window.clearInterval(this.intervalRef); }, start: function (callback) { this.intervalRef = window.setInterval(callback, this.interval) }; var Module = (function () { function getMessage () { return "weee!"; } var somethingThatReallyNeedsSpeed = function () { var iterations, self = this; this.start(function () { console.log(getMessage()); iterations++; if(iterations > 10000) { self.finish(); } }); } somethingThatReallyNeedsSpeed.prototype = Mixin; return somethingThatReallyNeedsSpeed; })();
In this example, the build speed does not drop so much because the prototype is only set to reference the Mixin object - there are two methods and a property that a particular function should not create every time, but it is still available through this .
</rant>