On Sat, 6 Nov 2010, Igor Stasenko wrote:
I suppose its related to fact, that with small number of cases (like up to 16) its not worth using indirect jump, because with branch prediction you can achieve same or even better performance. That's why i think, modern compilers do not using jump tables. Having more than 16 number of cases, is an edge case. Not saying about 256.
I expect a compiler to generate the fastest possible code, if I ask for that. I think we agree, that gcc doesn't do this.
Levente
Btw, I was also thinking that compilers generating jump tables for case statements.