Math.atan2 vs fast approx. atan2 vs cached Math.atan2Fastest: fast approx. atan2 (1.5x faster)
1,669,946 ops/sec
1,504,007 ops/sec
1,137,601 ops/sec
Fastest: fast approx. atan2 (1.2x faster)
2,837,684 ops/sec
2,560,304 ops/sec
2,305,402 ops/sec
Fastest: fast approx. atan2 (1.5x faster)
846,816 ops/sec
761,138 ops/sec
582,132 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Math.atan2 | |
| fast approx. atan2 | |
| cached Math.atan2 |
| Test name | Executions per second |
|---|---|
| ✓ fast approx. atan2 | 4,349,316 Ops/sec |
| cached Math.atan2 | 3,189,924 Ops/sec |
| Math.atan2 | 3,092,531 Ops/sec |