What to expect from project Valhalla
summary
Project Valhalla adds value classes to Java: classes without identity that the JVM may flatten into packed arrays for much better locality and less GC. A prototype and a Mark Hofmann sandbox are available (build with enable-preview), and microbenchmarks on 100M-point loops show speedups typically around 2x, sometimes 10x and occasionally much larger in idealized cases; one current build has a flattening bug. Key tradeoffs: no per-instance synchronization, null-restricted types (bang syntax), zero-default opt-in, and unresolved generics/specialization.
AI-written summary · about
chapters (25)
- 0:00Introduction and speaker background
- 1:47Overview of Java projects including Valhalla
- 2:51Primitive vs reference types in Java
- 5:20Performance benefits of value types
- 9:34Motivations behind Project Valhalla
- 9:58Value classes and their properties
- 12:50Equality comparison in value types
- 15:58Value type construction and storage
- 17:24Polymorphic equals for value types
- 19:52Candidates for value classes
- 22:01Technical differences between class types
- 25:33Construction sequence for value classes
- 27:39Null handling in value types
- 30:10Null restrictions and array handling
- 33:19Circularity and flattening limitations
- 34:23Default initialization of value types
- 36:07Atomic updates and performance guarantees
- 37:53Migration strategy and generics challenges
- 40:45Universal vs specialized generics
- 41:50Historical evolution of Valhalla
- 42:31Building and experimenting with Valhalla
- 43:35Benchmarking value types with Brownian motion
- 45:42Performance analysis and JIT optimizations
- 46:26Timeline and future of Valhalla
- 47:31Q&A and conclusion
