What happens to your code when you don't look?
summary
Shows that HotSpot’s C1/C2 JIT and Rust/GCC-style AOT compilers actually reorder and replace code: using Compiler Explorer and JITWatch reveals a virtual call that becomes inlined when polymorphism drops from three implementations to two, escape analysis that eliminates heap allocations so GC allocations fall to near zero and a benchmark speeds up roughly 5x, and perf counters that expose cache-line and branch-prediction penalties when accessing shuffled arrays. Tools: Compiler Explorer, JITWatch, perf.
AI-written summary · about
chapters (8)
- 0:00Introduction and speaker intro
- 2:31How compilers transform code
- 8:57JIT optimizations in Java
- 13:40Escape analysis and heap allocation
- 20:50CPU cache effects on performance
- 27:18Branch prediction in modern CPUs
- 31:12Compiler optimizations and correctness
- 33:22Summary and closing remarks
related talks
59mCompilers can be surprising
54mWhat Lies Beneath
44mJIT Me Baby One More Time
26mAn Analysis of Compiled Code Reusability in Dynamic Compilation
43mAuto-Vectorization in HotSpot
47mWhat Lies Beneath
47mHow an Optimizing Compiler Works
50mWhat’s really going on under the hood? The hidden life of method calls.
