RFR: 8242842: Avoid reallocating name when checking for trailing slash in ZipFile.getEntryPos
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. Thanks! /Claes [1] https://bugs.openjdk.java.net/browse/JDK-8145260
Hi Claes, I think this looks good overall. Vwar LNXW
On Apr 15, 2020, at 8:58 AM, Claes Redestad <claes.redestad@oracle.com> 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.
Thanks!
/Claes
<http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen@oracle.com <mailto:Lance.Andersen@oracle.com>
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
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
participants (3)
-
Alan Bateman
-
Claes Redestad
-
Lance Andersen