RFR 8189319 : Add a java.util.Properties constructor that takes an initial capacity

Brent Christian brent.christian at oracle.com
Fri Oct 27 01:43:26 UTC 2017


Hi,

It would be useful to have a Properties constructor that takes an 
argument to set the initial capacity. Such a constructor is present on 
many of the other Map implementations in the JDK, including Hashtable, 
the superclass of Properties.

In particular, being able to specify the initial capacity of the 
Properties object created to store the system properties could reduce 
startup time.  The current initial capacity of 8 is insufficient.  We 
could eliminate ~25,000 bytecodes currently spent resizing the 
Properties by creating one of sufficient initial size.

There are ~60 system properties in a minimal Java app.  I chose 84 - it 
provides a good amount of wiggle room (and results in an internal 
ConcurrentHashMap with a table size of 128; 64 would be too small, IMO).

Please review this change:

Issue:  https://bugs.openjdk.java.net/browse/JDK-8189319
Webrev: http://cr.openjdk.java.net/~bchristi/8189319/webrev.01/

Thanks,
-Brent


More information about the core-libs-dev mailing list