Issue After reading this post (answer on StackOverflow) (at the optimization section), I was wondering why conditional moves are not vulnerable for Branch Prediction Failure. I found on an article on cond moves here (PDF by AMD). Also there, they
Continue readingTag: branch-prediction
[SOLVED] Why is a conditional move not vulnerable to Branch Prediction Failure?
Issue After reading this post (answer on StackOverflow) (at the optimization section), I was wondering why conditional moves are not vulnerable for Branch Prediction Failure. I found on an article on cond moves here (PDF by AMD). Also there, they
Continue reading[SOLVED] Branch prediction overhead of perfectly predicted branch
Issue I read that a perfectly predicted branch has zero / almost-zero overhead. (For example in an answer on Effects of branch prediction on performance?) I don’t quite understand what people mean by this. At least the branch condition has
Continue reading[SOLVED] How to deal with branch prediction when using a switch case in CPU emulation
Issue I recently read the question here Why is it faster to process a sorted array than an unsorted array? and found the answer to be absolutely fascinating and it has completely changed my outlook on programming when dealing with
Continue reading[SOLVED] Why is (a*b != 0) faster than (a != 0 && b != 0) in Java?
Issue I’m writing some code in Java where, at some point, the flow of the program is determined by whether two int variables, "a" and "b", are non-zero (note: a and b are never negative, and never within integer overflow
Continue reading[SOLVED] Why is processing a sorted array faster than processing an unsorted array?
Issue Here is a piece of C++ code that shows some very peculiar behavior. For some strange reason, sorting the data (before the timed region) miraculously makes the loop almost six times faster. #include <algorithm> #include <ctime> #include <iostream> int
Continue reading