Optimizing the decoder lookup tables is equivalent to the C switch statement optimization problem.
Determined humans are likely to do better than javac at producing bytecode that will JIT well because - javac is not designed to be an optimizing compiler. javac will generate complicated code that the hotspot optimizer may have a hard time with. - humans have special knowledge about the frequency of particular characters. E.g. they may know that the euro character is relatively rare. I've considered (but not seriously) writing a special compiler that takes as input the conversion tables and the empirical frequency of characters in text in various encodings and outputs a combination of table lookups and nested ifs that will perform very well in practice. Martin On Tue, Jun 24, 2008 at 9:15 AM, David M. Lloyd <[EMAIL PROTECTED]> wrote: > On 06/24/2008 11:08 AM, Ulf Zibis wrote: >> >> I many cases I also could shorten the encoding mappings. >> >> Example: >> https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/branches/milestone1/src/sun/nio/cs/ext/IBM870.java?rev=223&view=markup > > Would a 'switch' statement not be more speed- and space-efficient for this > type of lookup task? > > - DML >