crazy2be/buildshoot — pull request #70 by crazy2be (2013-04-30 21:13:43+00:00)
Title: Speed

A couple of performance boosting changes:

- Blocks have been made a much more lightweight class to construct (and destruct). About 10% of the clients time was being spent in client-side prediction (with ~200ms lag), and half of that was just in the block constructor. I was considering nuking the class entirely, and just passing around raw data values, but I was able to get it to an acceptable speed level without any changes to the external API, which is nice. Not only does it make client-side prediction faster, it also reduces the time spent in the garbage collector. Double bonus!
- Object prototypes are faster when objects are being constructed and destructed frequently, since it makes the objects themselves smaller. However, constructor functions (as we use everywhere else) are faster when the objects are being constructed and destructed infrequently, and being interacted with much more frequently, since you avoid an extra indirection when accessing private member variables.

- The PerfChart class has been rewritten from the ground up to be MUCH faster. It used to take ~10ms every frame on my computer just to render the perfChart (well, all the HTML technically, but the perfChart was causing the invalidation), and it now takes about 3% of the available frametime to render, or >1ms per frame.