Brian Feliciano wrote:
i know their difference coding-wise, but im a bit concerned about speed and performance and efficiency. (as you may have already noticed, im a bit paranoid about performance/speed)

One more thing. The class-based OO emulated by prototype will be slightly slower because it is doing more work than using a single classless object. But make you decision on what is the most maintainable not on the speed. There will not be a noticeable difference between the two. The class emulation provided by prototype is just a thin wrapper around the way JavaScript normally spawns new objects from prototype objects so it is in line with the way JavaScript is supposed to work.

If you need many instances of an object use the support JavaScript provides to generate many similar instances from a prototype object or use the class emulation that prototype provides if that makes more sense to you. Only make performance decisions after you have profiled your code and determined the hot spots. Otherwise you will be just wasting time saving no more than a few instructions.

Eric

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to