Branchless Programming
Modern processors have very deep pipelines, making branch mispredictions costly. Compilers are pretty good at removing branches but not perfect at it. Here's a list of interesting things I've read on "branchless" programming:
- Branchless programming, an article
- Branchless Programming, a Github repo
- A loopless and branchless
O(1)
algorithm to generate the nextDyck word - Branchless Equivalents of Simple Functions
- Branchless Rust
- Branchless Conditionals (Compiler Optimization Technique)
- Making Code Faster: Taming Branches
- Chess Programming Wiki: Avoiding Branches
The Chess Programming wiki is probably the most obsessive piece in this list with additional references around the internet. I mean this in a good way. Chess folks do some of the most unusual high-performance programming around.