RFR: 8242842: Avoid reallocating name when checking for trailing slash in ZipFile.getEntryPos
Claes Redestad
claes.redestad at oracle.com
Wed Apr 15 14:05:19 UTC 2020
Lance, Alan,
thanks for reviewing!
I think there's more things we can improve in this area, but will move
ahead carefully.
/Claes
On 2020-04-15 15:52, Alan Bateman wrote:
>
>
> On 15/04/2020 13:58, Claes Redestad wrote:
>> Hi,
>>
>> a trivial optimization to ZipFile.getEntryPos extracted from some
>> experiments conducted mostly by Eirik Bjørsnøs.
>>
>> Webrev: http://cr.openjdk.java.net/~redestad/8242842/open.00/
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8242842
>>
>> This removes an extra array copy on every miss, and the patch means a
>> small speed-up on a few startup applications I've tested (Spring
>> Petclinic: ~50ms faster).
>>
>> This is an optimization which was lost in translation when porting from
>> native to Java[1] in JDK 9. The native implementation allocates an
>> array that can fit the extra '/' if needed, and updates the array in
>> place for the follow-up check.
> Good sleuthing! I remember that code in zip_util.c and it looks like the
> re-write didn't bring it over completely. The webrev looks good.
>
> -Alan
More information about the core-libs-dev
mailing list