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

Michal Moskal malekith@pld-linux.org
Sun, 17 Oct 2004 12:56:41 +0200


On Sat, Oct 16, 2004 at 07:08:09PM -0500, Marcus wrote:
> 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.

However, when you have switch in the CIL, it's up to the JIT how to handle
it. And choosing between the if-else and the jump-table implementation
can be machine dependent, performance wise.

-- 
: Michal Moskal :: http://www.kernel.pl/~malekith :: GCS !tv h e>+++ b++
: ::: Logic is a nice contrast to the Real World. :: UL++++$ C++ E--- a?