logoalt Hacker News

chrkatoday at 4:02 PM1 replyview on HN

Don't trust your compiler. Your code is only fast if you're lucky.

https://tiki.li/blog/lucky_code.html


Replies

charleslmungertoday at 5:48 PM

I agree you can't trust your compiler, but you can control its behavior more reliably with __builtin_expect_with_probability

https://github.com/protocolbuffers/protobuf/commit/9f29f02a3...