This PR replaces all instances of Math.hypot with Math.sqrt. It also removes the polyfill for hypot on really old browsers.
The reason is that sqrt is MUCH faster than hypot on all modern javascript engines. See #446 for some benchmarks.
While hypot is nicer to write, and is technically more accurate especially for very large and very small numbers, I think that the performance gains from switching to sqrt are worth it. Especially for a library with the goal:
glMatrix is designed to perform vector and matrix operations stupidly fast!
Fixes #446
This PR replaces all instances of
Math.hypot
withMath.sqrt
. It also removes the polyfill for hypot on really old browsers.The reason is that
sqrt
is MUCH faster thanhypot
on all modern javascript engines. See #446 for some benchmarks.While hypot is nicer to write, and is technically more accurate especially for very large and very small numbers, I think that the performance gains from switching to
sqrt
are worth it. Especially for a library with the goal:Suggestions and feedback appreciated.