r/programming 1d ago

Branch‑Avoidant Programming

https://easylang.online/blog/branchless
230 Upvotes

87 comments sorted by

View all comments

-2

u/hacksoncode 21h ago

Trying to figure out what will be optimal for a particular processor family is a job for the compiler/optimizer.

Super Geniuses that try to optimize this stuff themselves are just annoying to the people that have to maintain the code.

That's not to say there aren't some very specific circumstances where hand-optimization like this can make a big improvement on a problem that's actually limited by loop efficiency in a way that optimizers can't figure out, but normally it's a bad thing to think about.

3

u/bwainfweeze 19h ago

To be fair, we are in the somewhat historically unique situation of AWS providing one exact architecture of server to run your same cluster for five, eight years at a time with zero substitutions. Anywhere else in software history, except supercomputers, it would be insane to optimize for a single processor.

Honestly am surprised they don’t end up retiring the old instance types sooner.