Are there any differences in code optimization performed by the same versions: Oracle Java compiler Apache Java compiler IBM Java compiler OpenJDK Java compiler.
Although the compiler may be completely different, it javachardly optimizes. The main optimization is constant insertion, and this is indicated in JLS and, thus, is standard (except for any errors)
If some code demonstrates various optimizations?
You can do it.
final String w = "world";
String a = "hello " + w;
String b = "hello world";
String c = w;
String d = "hello " + c;
System.out.prinlnt(a == b);
System.out.prinlnt(c == b);
In the first case, the constant was embedded and the string was merged at compile time. In the second case, concatenation was performed at run time and a new line was created.
Or do they use the same compiler?
No, but 99% of the optimizations are performed during JIT execution, so they are the same for this version of the JVM.
, ?
, , . , JIT , , JIT . JVM, .