RFR (s): 8176894 Provide specialized implementation for default methods putIfAbsent, computeIfAbsent, computeIfPresent, compute, merge in TreeMap
Tagir Valeev
amaembo at gmail.com
Mon Sep 9 03:58:01 UTC 2019
Hello everybody!
Another one gentle reminder: please review the changeset and the CSR.
Please note that the change is not that big: it's only several new
methods in single TreeMap class, a few new unit-tests, and a
benchmark. Here's issue:
https://bugs.openjdk.java.net/browse/JDK-8176894
Webrev:
http://cr.openjdk.java.net/~tvaleev/webrev/8176894/r2/
CSR:
https://bugs.openjdk.java.net/browse/JDK-8227666
Thanks! The original e-mail follows.
> Please review the following patch:
> http://cr.openjdk.java.net/~tvaleev/webrev/8176894/r2/
> https://bugs.openjdk.java.net/browse/JDK-8176894
>
> Also please review the associated CSR:
> https://bugs.openjdk.java.net/browse/JDK-8227666
>
> The patch was originally submitted by Sergey Kuksenko in March 2017 and reviewed by some people:
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2017-March/046825.html
> The latest patch submitted by Sergey is here:
> http://cr.openjdk.java.net/~skuksenko/corelibs/utils/8176894/webrev.01/
>
> I asked Sergey why it was abandoned. Seems there were no particular reason and Sergey asked if I could pick up this work. I will be happy to finish it.
>
> Here's the list of differences between the latest Sergey patch and my patch:
> - A bug is fixed in putIfAbsent implementation. TreeMap.java, lines 576 and 596: `|| oldValue == null` condition added (the null value should be overwritten no matter what)
> - A testcase is added to cover this problem (InPlaceOpsCollisions.java, also checks HashMap and LinkedHashMap). Not sure if it's the best place for such test though. Probably a separate file would be better?
> - TreeMap.merge() implementation is added.
> - TreeMap is added to the FunctionalCMEs.java test (btw this file copyright says that it's a subject to Classpath exception which is probably wrong?)
> - Simple microbenchmark is added: TreeMapUpdate.java
>
> My quick benchmarking shows that optimized version is indeed faster for the most of the tests and no regression is observed for put() method. Here's raw results of jdk13-ea+26 and jdk13-ea+26+patch if anybody is interested.
> http://cr.openjdk.java.net/~tvaleev/jmh/JDK-8176894/
With best regards,
Tagir Valeev
More information about the core-libs-dev
mailing list