I have some difficulty to understand LookUpSwitch and TableSwitch in Java bytecode.
If I understand well, both LookUpSwitch and TableSwitch correspond to the s
I suspect it is mostly historical, due to some specific binding of Java bytecode to underlying machine code (e.g. Sun's own CPU).
The tableswitch
is essentially a computed jump, where destination is taken from a lookup table. By contrast, lookupswitch
requires comparison of each value, basically an iteration trough table elements until matching value is found.
Obviously those opcodes are interchangeable, but based on values, one or the other could be faster or more compact (e.g. compare set of keys with large gaps in between and a sequential set of keys).