We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Psst! A Sneak Peek at StableValue and SegmentMapper by Per Minborg
Learn about StableValue's thread-safe field initialization and SegmentMapper's memory mapping capabilities in Java, with performance insights and practical use cases.
- 
    StableValue provides deferred immutability - fields can be initialized exactly once, even in multi-threaded environments 
- 
    Offers performance benefits through constant folding - once initialized, values are treated as constants by the JVM 
- 
    Includes several variants: - StableValue for single values
- StableFunction for function results
- StableCollections for collections
- StableSupplier for lazy initialization
 
- 
    SegmentMapper provides efficient memory mapping capabilities: - Maps flat memory to structured data
- Works with records and custom layouts
- Useful for serialization and FFM (Foreign Function & Memory API)
- Reduces verbose boilerplate code while maintaining performance
 
- 
    Key advantages over traditional approaches: - Better performance than double-checked locking
- Thread-safe initialization
- No synchronization overhead after initialization
- Composable with other stable values
- Null-safety guarantees
 
- 
    Typical use cases: - Lazy logging initialization
- Caching computed values
- Singleton implementations
- Component initialization in larger applications
- Binary data serialization
 
- 
    Current status: - StableValue JEP recently submitted
- Targeting mid-20s Java releases
- Being refined before full release
- Part of ongoing Java performance improvements