[Mono-list] [Off-topic] "if else" or "switch" ?

Marcus mathpup@mylinuxisp.com
Sat, 16 Oct 2004 19:08:09 -0500


On Saturday 16 October 2004 3:53 am, Michal Moskal wrote:

No, I don't think that it's a completely a runtime issue. There are at least 
three fundamentally-different mechanisms for handling a switch statement, 
including hashing, binary search, and a linear if/else. With CIL, there is 
the further complication of using the switch instruction versus the compare 
and branch sequences.

> I guess the entire idea behind the .NET is that the compiler don't have
> to deal with choices like switch vs if -- the runtime is going to take
> care of it. Using switch in the IL should be just a hint for the
> runtime. So there is nothing to change in the mcs. The runtime is what
> should be fixed, if anything.