RFR: 8310837: Use ByteArrayLittleEndian in java.util.zip

Lance Andersen lancea at openjdk.org
Mon Jun 26 14:18:04 UTC 2023


On Fri, 23 Jun 2023 20:00:12 GMT, Glavo <duke at openjdk.org> wrote:

> Using `ByteArrayLittleEndian` is simpler and faster.
> 
> `make test TEST="micro:java.util.zip.ZipFileOpen"`:
> 
> 
>   Benchmark                     (size)  Mode  Cnt      Score      Error  Units
> - ZipFileOpen.openCloseZipFile     512  avgt   15  39052.832 ±  107.496  ns/op
> + ZipFileOpen.openCloseZipFile     512  avgt   15  36275.539 ±  663.193  ns/op
> - ZipFileOpen.openCloseZipFile    1024  avgt   15  77106.494 ± 4159.300  ns/op
> + ZipFileOpen.openCloseZipFile    1024  avgt   15  71955.013 ± 2296.050  ns/op

> @LanceAndersen This one is going to require checking that startup isn't impacted.



> @LanceAndersen This one is going to require checking that startup isn't impacted.

ZipFS has a slightly different macro for `SH`:

  ```
 static final int SH(byte[] b, int n) {
        return Byte.toUnsignedInt(b[n]) | (Byte.toUnsignedInt(b[n + 1]) << 8);
    }


I think as we compare performance, we also should strive for consistency between Zip and ZipFS implementation as well

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14632#issuecomment-1607586514


More information about the core-libs-dev mailing list