• Sources: primary
  • Summary: Sven Woltmann measured a program that compiles 50 files per round with javac: with AOT cache profiles, rounds 2 to 5 took 13.9% less time on Java 25, but from about round 30 the program ran slower than with no cache, 5% slower after 200 rounds on Java 28. He traces the long-run loss to profiles losing their lambda entries when the cache is written, so C2 stops inlining those lambdas. On Java 28, eager compilation of trained methods made the first round 17.5% slower by queuing thousands of tasks ahead of methods the program needed.
  • Why it matters: Teams adopting AOT caches for startup should benchmark steady-state throughput too, and can compare with -XX:-AOTReplayTraining or -XX:-AOTCompileEagerly.
  • Background: HotSpot runs code in an interpreter, then compiles hot methods with C1 and later the optimizing C2 compiler, which uses runtime profiles of branches and receiver types to decide inlining and speculation. Project Leyden's AOT cache, created from a training run, stores loaded and linked classes since Java 25, and JEP 515 adds those method profiles so C2 can start optimizing earlier.