Demo: watching the JIT with -XX:+PrintCompilation
On This Lesson 3 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
see compilation events live; prepares MID-001-LAB1.
Draft outline details
Step by step
- Write a loop calling a small pricing method a million times, timing batches.
- Run with
-XX:+PrintCompilation; find the method's lines. - Read the tier column (levels 1-4; level 4 is C2) and notice
made not entrantlines (deoptimization). - Print batch timings and match speed-ups to compilation events.
- Planned mistake: time a single cold call and conclude the method is slow. Fix: warm up first, then measure many iterations (or use JMH).
- Link to the lab: apply the same reasoning to the first 1,000 Shop checkout requests. Output format is version-specific; verify version before recording.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.