RFR: 8221921: Implement size() / isEmpty() in immutable collections
Claes Redestad
claes.redestad at oracle.com
Thu Apr 4 10:29:20 UTC 2019
Hi,
a few of the ImmutableCollections are inheriting size and/or isEmpty
from abstract base classes. A few of these are inefficiently
implemented, e.g., on a Map1, isEmpty() will effectively be
"return entrySet().size() == 0" when it could be simply "return
false".
This patch provide specialized implementations which JITs do the right
thing while also helping startup slightly.
Bug: https://bugs.openjdk.java.net/browse/JDK-8221921
Webrev: http://cr.openjdk.java.net/~redestad/8221921/open.00/
Testing: tier1-2, verified a tiny improvement in startup profiles
Thanks!
/Claes
More information about the core-libs-dev
mailing list