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

Avoid reallocating name when checking for trailing slash in ZipFile.getEntryPos

    XMLWordPrintable

Details

    Description

      getEntryPos does this:

                      /* Add slash and try once more */
                      name = Arrays.copyOf(name, name.length + 1);
                      name[name.length - 1] = '/';
                      hsh = hash_append(hsh, (byte)'/');

      A trivial optimization to ZipFile.getEntryPos would be to only copy the name array after finding a match for the re-calculated hash value. This removes an allocation and array copy on every miss.

      Attachments

        Issue Links

          Activity

            People

              redestad Claes Redestad
              redestad Claes Redestad
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: