Tag: performance

Java Autoboxing: How It Compiles and How the Integer Cache Works

How javac compiles autoboxing into Integer.valueOf() and intValue() calls, checked in JDK 25 bytecode, plus the -128 to 127 IntegerCache, JLS 5.1.7, -XX:AutoBoxCacheMax, boxing costs in loops, and what changed from JDK 5 to JDK 25.

Continue Reading

How Java Optimizes String Concatenation

How javac and the JDK runtime optimize String concatenation with + across versions: StringBuffer in JDK 1.4, StringBuilder in JDK 5, invokedynamic in JDK 9, and hidden classes in JDK 24, with bytecode checked on JDK 25.

Continue Reading