[Mono-devel-list] mcs code for switches on strings

Marcus mathpup at mylinuxisp.com
Fri Mar 19 23:21:48 EST 2004

Please define "several." Is it 5? 10? 20? 1000?

To be honest, when I started looking into this, I was wondering about the 
break-even point. I have not yet had a chance to conduct systematic tests. 
Nevertheless, it seems to me a reasonable assumption that in the days of 
optimizing compilers, a compiler should not generate *worse* code for a 
switch than a nested if.

On Saturday 20 March 2004 9:49 am, Richard Torkar wrote:

> Hmm, is it just me or isn't switch/case supposed to execute faster when
> comparing several strings like above? I learnt that many years ago, thus
> I consequently use switch/case in stead of nested if-statements if it
> looks like the above.
> Is this not true anymore as a general rule?

More information about the Mono-devel-list mailing list