Skip to content
Ameen Abozaid
Planned lessonMID-001-L06

Demo: watching the JIT with -XX:+PrintCompilation

  • Lesson 6 of 6
  • Mid-level
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

  1. Write a loop calling a small pricing method a million times, timing batches.
  2. Run with -XX:+PrintCompilation; find the method's lines.
  3. Read the tier column (levels 1-4; level 4 is C2) and notice made not entrant lines (deoptimization).
  4. Print batch timings and match speed-ups to compilation events.
  5. Planned mistake: time a single cold call and conclude the method is slow. Fix: warm up first, then measure many iterations (or use JMH).
  6. 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.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Type to search levels, phases, modules and lessons.