

JSRs: What Lies Beneath - Garbage
http://www.infoq.com/news/2010/09/what-lies-beneath

======
jsankey
The example of the complication involved in making Strings in switch
statements efficient intrigues me. The point is that implementations are more
complicated than they might first seem. But it looks in this case like the
additional complication was (in part, at least) a choice.

I don't see why the initial implementation couldn't be simpler. Wouldn't the
simple implementation have similar performance to the status quo (i.e. using
if statements), with the immediate benefit of cleaner syntax? In fact, why
should this level of optimisation be part of the JSR at all? It sounds like
something the JVM implementers could optimise without any change to the way
the switch works. Tying it to the JSR makes the spec more complicated, delays
an initial version and forces this optimisation to be prioritised over others.

