Runtime vs. compile time (JIT vs. AOT) optimizations in Java and C++
summary
Compares JIT C2 (HotSpot/OpenJDK) vs LLVM clang on identical microbenchmarks using JITWatch, Java Measurement Harness, Google Benchmark and perf, showing concrete generated assembly and timings. Finds clang vectorizes aggressively (main/post loops use 32 integers per cycle or full unrolled constants, giving up to one order of magnitude speedup in a naïve sum), while JIT C2 initially disables vectorization but JDK9 adds 32–64-int ymm vectorization; JIT uses uncommon trap null-checks and can elide locks via escape analysis, while object headers and field reordering cause measurable cache differences.
AI-written summary · about
