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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: