mazzo.li — blag — Speeding up `atan2f` by 50x
`atan2f` is an important but slow trigonometric function. In this article we'll explain how to approximate it, and implement a version 50x faster than `libc` on batches of inputs.
Some fun math and performance optimization tricks here.
“The goal of the article is to both show how trascendental functions are computed, and how to micro-optimize guided by looking at the assembly. However, if you don’t care about how we compute atan2, you can skip the second section while still understanding the optimizations process.
As usual, everything is presented without assuming much previous knowledge — in this case just basic trigonometry and C programming.”Posted on 2021-08-17T19:40:24+0000