Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8078463

TEST_BUG: optimize java/util/Map/Collisions.java

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 9
    • None
    • core-libs
    • None

        The test java/util/Map/Collisions.java contains the following code:

            for (int i = 0; i < keys.length; i++) {
                check(String.format("insertion: map expected size m%d != i%d", map.size(), i), map.size() == i);
                check(String.format("insertion: put(%s[%d])", keys_desc, i), null == map.put(keys[i], keys[i]));
                check(String.format("insertion: containsKey(%s[%d])", keys_desc, i), map.containsKey(keys[i]));
                check(String.format("insertion: containsValue(%s[%d])", keys_desc, i), map.containsValue(keys[i]));
            }

        and many similar cases. These are expensive, as they format a string that is in most cases thrown away. The check() method should be rewritten to use lazy message formatting.

              smarks Stuart Marks
              smarks Stuart Marks
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: