[9] RFR (XXS): 8031043: ClassValue's backing map should have a smaller initial size

Christian Thalinger christian.thalinger at oracle.com
Thu Jan 23 20:16:30 UTC 2014


https://bugs.openjdk.java.net/browse/JDK-8031043
http://cr.openjdk.java.net/~twisti/8031043/webrev.00

8031043: ClassValue's backing map should have a smaller initial size
Reviewed-by:

The current initial size for ClassValue's backing WeakHashMap (ClassValueMap) is: 

        private static final int INITIAL_ENTRIES = 32; 

This is too big and wastes a lot of memory. Usually a dynamic language or other users of ClassValue associate only one value with a Class. Even if users need more entries it's better to start small and grow as needed since adding new values to a Class is a one-time thing and not performance critical.

Here is some discussion on the mlvm-dev list:

http://mail.openjdk.java.net/pipermail/mlvm-dev/2014-January/005597.html




More information about the core-libs-dev mailing list