RFR: 8242842: Avoid reallocating name when checking for trailing slash in ZipFile.getEntryPos
Alan Bateman
Alan.Bateman at oracle.com
Wed Apr 15 13:52:01 UTC 2020
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