4 ms·
Excellent write up, thank you! It starts kind of slow, but then somehow morphs into effortlessly explaining advanced topics. I knew bits and pieces of this bef
by branko_d 5y ago
Excellent write up, thank you!
It starts kind of slow, but then somehow morphs into effortlessly explaining advanced topics. I knew bits and pieces of this before, but I found information that was genuinely new to me, like this gem:
”Going back to the original example, that is why the perfectly predicted copy_odds_branches! performs better than code_odds_branchless!. Even though the latter has fewer instructions, it has a memory dependency: The index of dst where the odd number gets stored to depends on the last loop iteration. So fewer instructions can be executed at a time compared to the former function, where the branch predictor predicts several iterations ahead and allow for the parallel computation of multiple iterations.”