if you do a micro benchmark of the performance between the to switch
forms in Java (in bytecode) you will most probably not see a big
difference between them. and they will probably behave just the same as
a normal if-else cascade. Of course this is onlytrue on certain VMS, on
others it is faster/slower, ut by such a small amount... its not worth
it I say.
My understanding was that Groovy's switch is not a binary search, but a
series of invoke/compare/jumps. That would be considerably slower than a
direct jump table or a binary search. CS 101: a series of ifs will be
O(n), a binary search will be O(log n), and table lookup O(1). table
lookup is faster, so I believe it would be worth it.