hg: jdk8/tl/jdk: 8008167: IdentityHashMap.[keySet|values|entrySet].toArray speed-up

Mike Duigou mike.duigou at oracle.com
Mon Feb 25 20:24:01 UTC 2013

I made one additional change to the regression test so that the keys and values aren't in the same range. It didn't produce any failures but I think it is a good addition to catch future bugs.


diff --git a/test/java/util/Map/ToArray.java b/test/java/util/Map/ToArray.java
--- a/test/java/util/Map/ToArray.java
+++ b/test/java/util/Map/ToArray.java
@@ -67,7 +67,7 @@ public class ToArray {
     static {
         for (int each = 0; each < TEST_SIZE; each++) {
             KEYS[each]   = Integer.valueOf(each);
-            VALUES[each] = Long.valueOf(each);
+            VALUES[each] = Long.valueOf(each + TEST_SIZE);

On Feb 25 2013, at 01:51 , Alan Bateman wrote:

> On 25/02/2013 04:06, Mike Duigou wrote:
>> I have created an issue for fixing the introduced regression and created a regression test that would have caught the error (fix a bug, write a test...).
>> 8008785: IdentityHashMap.values().toArray(V[]) broken by JDK-8008167
>> http://cr.openjdk.java.net/~mduigou/JDK-8008785/0/webrev
>> Mike
> The fix to IdentityHashMap looks good. It is surprising that it wasn't caught by tests in the jdk repository so a reminder that we always need to check that we have good test coverage when doing performance fixes.
> The webrev suggests you've replaced Map/Collisions.java and assume that is not the intention. Otherwise the new test looks okay, an alternative would have been to expand MOAT.
> -Alan.

More information about the core-libs-dev mailing list