RFR: 8242842: Avoid reallocating name when checking for trailing slash in ZipFile.getEntryPos
Lance Andersen
lance.andersen at oracle.com
Wed Apr 15 13:48:37 UTC 2020
Hi Claes,
I think this looks good overall.
Vwar
LNXW
> On Apr 15, 2020, at 8:58 AM, Claes Redestad <claes.redestad at 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
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8145260
<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 at oracle.com <mailto:Lance.Andersen at oracle.com>
More information about the core-libs-dev
mailing list