I have a program that is about 300 times slower on a Java ME phone than on Java SE. Simple benchmarks show that manually inlining a method roughly doubles the phone's performance, and manually eliminating a common expression roughly doubles performance yet again. Clearly the Java ME implementation doesn't do any optimization.
Is there any compiler that takes Java source code and produces optimized Java bytecode (with method inlining, constant value propagation, common expression elimination, and other general optimizations)? Is there any other tools that optimize class files this way after compilation?