Is ‘switch’ faster than ‘if’?
There are several optimizations a compiler can make on a switch. I don’t think the oft-mentioned “jump-table” is a very useful one though, as it only works when the input can be bounded some way. C Pseudocode for a “jump table” would be something like this — note that the compiler in practice would need … Read more