- City of Wonder
- pow is slow http://www.emanueleferonato.com/2010/10/13/as3-geom-point-vs-trigonometry
- sqrt is also slow.
And I reckon I can beat your best case too.
Ugh… getting the bit representation of a Number (aka float) can’t be inlined.
I was impressed that removing the duplicated p1.x-p2.x and p1.y and p2.y didn’t give a speed improvement, the optimisation must be doing some common expression removal.
More sqrt implementations than you can shake a stick at: http://www.codeproject.com/KB/cpp/Sqrt_Prec_VS_Speed.aspx