JetbrainsIgor KulakovBenchmark
Where Did the Saved Bytes Go? Compact Object Headers in IntelliJ IDEA
Summary
IntelliJ IDEA evaluated compact object headers, enabled by default in Java 27 through Project Lilliput and JEP 534, on a large JVM application. Tests compared headers on and off for the Welcome screen, Spring Petclinic at about 3,370 lines, and the IntelliJ IDEA monorepo at about 26.5 million lines. Resident set size showed no consistent reduction at identical -Xmx limits, because RSS includes heap headroom, metadata, JIT code, stacks, native buffers, and shared libraries. Modeled footprints for identical captured heaps fell about 6.3% for Welcome and Petclinic and 8.2% to 8.4% for the monorepo, depending on object shapes, field offsets, and eight-byte padding. The lowest tested heap fell from 400 to 376 MiB for Petclinic and from 1,888 to 1,568 MiB for the monorepo, while operation times and GC metrics trended better; authors advise measuring RSS, heap, and speed separately.
Context
Compact object headers are the HotSpot feature from Project Lilliput and JEP 534, enabled by default in Java 27. In the tested 64-bit HotSpot configuration, a conventional instance header takes 12 bytes, an 8-byte mark word plus a 4-byte class pointer, while the compact layout compresses both into a single 8-byte word. Synthetic benchmarks often show smaller object footprints, but the evaluation asks what the change delivers for a massive real-world JVM application such as IntelliJ IDEA.
Approach / What changed
The evaluation used IntelliJ IDEA 2026.2.3 on JBR 25.0.4, explicitly switching compact headers on and off while holding the build, project snapshot, workload, and -Xmx values constant. It covered the Welcome screen, Spring Petclinic at about 3,370 Java/Kotlin lines, and the IntelliJ IDEA monorepo at about 26.5 million lines. The team sampled main-process RSS with ps, modeled object footprints for identical captured heaps, measured GC and operation latency, and stepped -Xmx downward until the indexing and editor scenarios completed every repeat.
Takeaways
At identical -Xmx limits, compact headers did not produce a statistically significant or consistent RSS reduction across the Welcome, Petclinic, and monorepo configurations.
Modeled heap footprints for identical captured populations fell about 6.3% for Welcome and Petclinic and 8.2% to 8.4% for the monorepo, showing savings inside the heap even when RSS hid them.
The lowest tested heap completing every repeat dropped from 400 to 376 MiB for Petclinic and from 1,888 to 1,568 MiB for the monorepo, but the authors warn these are boundary thresholds, not production recommendations.
FAQ
Why didn't compact headers reduce RSS even though object footprints shrank?
RSS counts physical pages mapped to the process, not just live Java heap objects. It also includes committed heap headroom, class metadata, JIT-compiled code, thread stacks, native buffers, shared libraries, and other memory-mapped files. Reducing object headers alone therefore may not lower RSS by a matching number of bytes.
Why doesn't a four-byte header reduction save four bytes per object?
HotSpot rounds each object's shallow size up to a multiple of eight bytes, so padding can absorb the four-byte header reduction. Field offsets and alignment also change: an object with one int stays 16 bytes, while an empty Object shrinks from 16 to 8 bytes and one with two ints from 24 to 16. The exact result depends on the class and the JVM's layout rules.
How much lower could -Xmx go in the tests?
For Petclinic, the lowest tested heap that completed every repeat fell from 400 to 376 MiB, a 6% reduction. For the monorepo, it fell from 1,888 to 1,568 MiB, a 320 MiB or 17% reduction. These were boundary thresholds, not suggested production configurations.
Source and freshness
- Source
- blog.jetbrains.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.