logoalt Hacker News

Joker_vD • today at 3:56 AM • 2 replies • view on HN

Yeah, it's all fun and games until you realize that you compiler may invent writes in order to eliminate a branch. Which is rather nonsensical, when you stop to think about it — surely an additional store to global can't be faster than a mispredicted branch?


Replies

homosapien97 • today at 4:56 AM

Branch mispredictions on deep machines can be devastating, whereas a store can hit in your L1. Storing can definitely be faster than a mispredicted branch if you think you'll hit in your L1/L2

adgjlsfhk1 • today at 4:53 AM

store to a global is typically 0 cycles (although subsequent reads may be slowed down)