A good read of Michael Abrash books explains that quite well, as does playing around Intel's VTune.
A good read of Michael Abrash books explains that quite well, as does playing around Intel's VTune.
If some/most of the actual tricks are not up to date (ahem) the whole book is filled with techniques, stories, concepts... It's more than ever a Zen of optimization opus.
Can someone on HN close to him tell Michael Abrash, should he write again, whatever he wants, even gardening or vulkanstuff wrangling, he has guaranteed readers.
I read the whole book(s) thrice cover to cover without touching a computer (these were the days) in my teens and it was easy to follow, and full of nuggets for a young aspiring programmer. I had third-hand 8086, 386 and pentium 75 boxes at the time, but didn't open Turbo C before I'd finished the book, and it was to try and implement a bsp tree, then a whole 3d stereo (anaglyphs) software renderer (inspired by the book).
Even right now i have two replies above yours that completely ignore the point of discussed article. Which is that algorithm is 'branchless'.
PS. I agree with comment in this topic from 'mgaunard' that algorithm should have been written as branchless explicitly.