JDK-8185496 : Improve performance of system properties initialization in initPhase1
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-07-28
  • Updated: 2018-11-15
  • Resolved: 2018-11-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 12
12 b20Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8213629 :  
The initialization of the system properties in System.initPhase1 is very inefficient due to the number of upcalls to Properties set/get/remove methods. In addition, it merges the properties from the VM which also invokes Properties methods.
[Potential improveoments to property upcalls will be addressed with issue 4947890. ]

Additionally, there are properties that are initialized to empty or default values in native.  That causes extra processing of each property before the value is needed.  The properties should be left uninitialized and defaults applied when they are first used.
For example, sun.cpu.isalist, sun.os.patch.level, user.timezone.
Also, there redundant values in java_props_md.c for:
     sprops.display_language = sprops.language;
     sprops.display_script = sprops.script;
     sprops.display_country = sprops.country;
     sprops.display_variant = sprops.variant;
JDK-7016814 suggests a new internal class to hold the private properties that may be covered by this issue. [~bchristi] I assign JDK-7016814 to you.

We could probably consider read-only properties during this work. The library and VM have a set of read-only predefined system properties (struct java_props_t and "java.home", "java.library.path" etc). One idea that Claes and I explore is to store them in a class (an array or individual fields) and these properties are read-only (System.setProperty could throw an exception). The system properties specified via -D are read-write.