We see runtime performance issues compiling Java 6 bytecode with Java 7. Is that expected?
No. It is not expected. It is possible … but I wouldn’t have predicted it, and I can’t think of an obvious explanation.
What are the downsides/benefits of doing that?
I can think of no real benefits to your problem (migration) of compiling code using Java 7 tools and setting to “-target” to “1.6”. I would go straight to compiling for the Java 7 platform.
Certainly, there is nothing to be gained from trying to figure out why the code apparently runs slower. It might be a real effect, or an illusion; e.g. an artefact of the way you are doing your benchmarking / performance measurement. But either way, it doesn’t tell you anything about what will happen if you compile for Java 7 and run on Java 7 … which is where you are trying to get to.
In general, you would not expect performance to be slower in a newer release of Java. However, there are factors that could cause performance characteristics to change. For example:
-
Changes in the JIT compiler might in theory cause certain atypical applications to run slower.
-
Changes in JIT compilation strategy might result in code being JIT compiled later … which could affect performance during startup / warmup. (A benchmarking should be designed to compensate for that …)
-
Changes in heap organization / garbage collection algorithms could require tuning / retuning.
And so on.
solved Are there any known runtime performance issues Compiling to Java 6 bytecode with Java 7 [closed]