Ayan Shafqat<p>Engineering is all about figuring out what is “good enough” to get the job done...</p><p>Back in the '90s, John Carmack and the team at ID Software faced a significant challenge. The computationally expensive inverse square root was holding back their goal of achieving playable frame rates in games. John Carmack’s ingenious contribution, the Fast Inverse Square Root (FISR), was an amazing achievement. While he might not have been the very first to explore this idea, his implementation was both innovative and influential. Also, I am not sure if Carmack was aware of any prior art of FISR. (Correct me if I am wrong)</p><p>Fast-forward a few decades, and I now find myself working in the field of Audio Signal Processing. When it comes to computing signal strength in decibels (20 log10(x)), the standard approach can be quite expensive computationally. Thus, the code below was my little achievement. Is it accurate? Of course not! But, it is close enough to about half a decibel. It even becomes more accurate the closer the signal goes towards zero.</p><p>When processing speech data from a microphone, the signal strength is much lower than -30 dB FS, where this function is typically 0.6% accurate to the real function. That means those expensive calls to logarithmic functions can be safely eliminated in many real-world applications.</p><p>I really admire these kinds of small innovations. They might not get a lot of media attention or the spotlight, but they can have a tangible impact: whether it’s enabling a smooth gameplay of Quake III Arena or extending battery life by reducing computational overhead.</p><p><a href="https://hachyderm.io/tags/engineering" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>engineering</span></a> <a href="https://hachyderm.io/tags/software" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>software</span></a> <a href="https://hachyderm.io/tags/optimization" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>optimization</span></a> <a href="https://hachyderm.io/tags/signalprocessing" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>signalprocessing</span></a> <a href="https://hachyderm.io/tags/C" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>C</span></a></p>