Strings in Switch
Per Bothner
per at bothner.com
Wed Dec 9 08:37:14 PST 2009
On 12/09/2009 02:42 AM, Fredrik Öhrström wrote:
> A tableswitch on
> arbitrary large numbers (aka hashcodes) must be compiled into a sequence
> of compares anyway (at least on the x86 platform). If the tableswitch
> happens on a sequence of relatively consecutive numbers, then the JVM
> can create a jump table. But for hashcodes, no way!
A tableswitch on arbitrary large numbers can be compiled
to use binary search in a sorted array, which should be fairly
efficient. (That is why the tableswitch entries are required to
be sorted.)
--
--Per Bothner
per at bothner.com http://per.bothner.com/
More information about the coin-dev
mailing list