tmpvar/vec2.js — pull request #5 by dominictarr (2013-06-15 17:35:37+00:00)
Title: improve performance

I've tried using vec2.js in my fork on [verlet-js](http://subprotocol.com/verlet-js/) https://github.com/dominictarr/verlet-js/tree/vec2

I found that it was significantly slower than the small vector lib that @subprotocol used.
made some changes that got me up to 60 fps on the cloth example. http://subprotocol.com/verlet-js/examples/cloth.html

verlet does loads of assignments, so mainly I've needed to improve that.

the worst thing was iterating over the cached properties instead of just setting them,
checking them seemed to be slow as well, so I just removed that, and recalculated the length each time.

(basically, I ran the examples, and checked the performance in the chrome debugger)

The tests still pass, with a minor change - removing the checks for dirty() and the cached properties.

Also, I've added `Vec2.fast` which defaults to no cleaning (also makes a detectable difference)