RFR: 8339874: Avoid duplicate checking of trailing slash in ZipFile.getZipEntry [v4]

Eirik Bjørsnøs eirbjo at openjdk.org
Wed Sep 11 07:28:06 UTC 2024


On Tue, 10 Sep 2024 19:57:56 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> Eirik Bjørsnøs has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add whitespace per review feedback
>
> src/java.base/share/classes/java/util/zip/ZipFile.java line 549:
> 
>> 547:                 // each "entry" has 3 ints in table entries
>> 548:                 int pos = res.zsrc.getEntryPos(i++ * 3);
>> 549:                 return (T)getZipEntry(new EntryPos(getEntryName(pos), pos));
> 
> Do we have benchmarks covering the various types of iteration?

I realized it's better to keep the signature of `getZipEntry` so these iteration callers won't need to construct the EntryPos. I assume calling `getEntryName` should have similar performance characteristic to the existing code which calls `getEntryPos` with a null name, since we're just seem to be moving the String decoding from one method to another.

But no, I don't think we have benchmarks for ZipEntry enumeration.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20939#discussion_r1753380817


More information about the core-libs-dev mailing list