RFR 8189319 : Add a java.util.Properties constructor that takes an initial capacity
mandy chung
mandy.chung at oracle.com
Fri Oct 27 18:19:43 UTC 2017
On 10/26/17 6:43 PM, Brent Christian wrote:
> 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/
Looks okay.
It may be cleaner to initialize the map in a single place e.g. a private
constructor taking Properties and initialCapacity.
Mandy
More information about the core-libs-dev
mailing list