jeromeetienne/fireworks.js — pull request #56 by tapio (2012-12-08 11:52:45+00:00)
Title: Performance improvements

I profiled my game in Chrome and noticed Particle.get took a whopping 30% of the CPU time. That's unacceptable so I took a look at the code and noticed it tries to play as safe as possible, but unfortunately at a great performance hit. So I replaced all that Particle.get/set stuff in core and plugins with the dot-notation (and removed asserts in critical code sections) and observed a huge performance win: my game went from 30 fps to stable 60. This can also be seen in e.g. webgl-flamethrower example where it got from around 45 fps to 60.

My hypothesis is that the bracket notation with a variable forces a dictionary look-up, whereas straight property access allows for optimizing it away with V8's hidden classes.

My goal was to delete the get/set methods completely, but all the examples need fixing first.

Note that there might be a couple of whitespace changes that sneaked in as I thought tabs used for alignment and word separators were mistakes, but then seeing how consistently those are everywhere concluded that you have a very weird coding style. :)