Navigation
Search
|
Stable values API would speed Java startup
Wednesday January 29, 2025. 01:31 AM , from InfoWorld
Startup times for Java applications would be improved through a proposed API for stable values, which are objects that hold immutable data.
An OpenJDK Java Enhancement Proposal (JEP) for a preview of stable values notes that stable values are treated as constants by the JVM, enabling the same performance optimizations that are enabled by declaring a field final. Compared to final fields, however, stable values provide greater flexibility as to the timing of initialization. Thus Java application startup would be improved by breaking up the monolithic initialization of application state. The JEP was updated on January 24, after originally being created in July 2023. The stable values preview would become part of the standard edition of Java, although no specific version of Java was named in the JEP. Other goals of the stable values proposal include decoupling the creation of stable values from their initialization, without significant performance penalties; guaranteeing that stable values are initialized no more than once, even in multi-threaded programs; and enabling user code to safely enjoy constant-folding optimizations previously only available to JDK-internal code. It is not a goal of the proposal to enhance Java with a means to declare stable values or to alter the semantics of final fields. In explaining the motivation for the stable values proposal, the JEP notes that Immutability has advantages, because an immutable object can be only in one state and therefore can be shared freely across multiple threads. The Java platform’s tool for managing immutability is final fields, but final fields have limitations, such as the need to be set eagerly, that restrict their applicability in many real-world applications.
https://www.infoworld.com/article/3811779/stable-values-api-would-speed-java-startup.html
Related News |
25 sources
Current Date
Jan, Thu 30 - 19:15 CET
|