RFR: 8242842: Avoid reallocating name when checking for trailing slash in ZipFile.getEntryPos
Claes Redestad
claes.redestad at oracle.com
Wed Apr 15 12:58:35 UTC 2020
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
More information about the core-libs-dev
mailing list