Java Value Types: what is it and why are they important
summary
Java gains Valhalla/inline classes as a pre-release (download at jdk.java.net/valhalla), introducing objects with no identity / immutable / passed-by-value and no inheritance or synchronization. The JIT uses stronger escape analysis to place short-lived values on the stack and pack arrays into contiguous memory, cutting cache misses—L1 ≈2 cycles, L2 ≈7, L3 ≈70, main memory ≈400 cycles—so benchmarks show substantial speed and memory improvements; examples and microbenchmarks are available on the project GitHub.
AI-written summary · about
chapters (15)
- 0:00Introduction to value types
- 3:40CPU waiting and latency
- 19:02Why CPU waits matter
- 20:08History of value types
- 23:08Restrictions of value types
- 28:12Immutability and identity
- 31:28No inheritance or polymorphism
- 34:21Value types as drop-in replacements
- 36:35Passing by value vs reference
- 42:03Performance benefits of value types
- 46:21Escape analysis and stack allocation
- 49:17JIT compiler optimizations
- 51:09Generics with value types
- 53:18How to experiment with value types
- 55:26Summary and takeaways
related talks
46mValue Types Aren't ℂomplex
20mCache Me If You Can: Speed Up Your JVM with Project Valhalla
47mValue Objects - The Next Big Thing in Java
35mValhalla Update
51mProject Valhalla: Flat Value Types in Java
52mValue Objects in Valhalla
45mMinimal Values Under the Hood
50mWelcome to LWorld: The current state of value types in Java
