On Wed, 25 Jan 2023 16:39:04 GMT, Per Minborg <pminb...@openjdk.org> wrote:
> This PR suggests improving performance by using the newly introduced class > `jdk.internal.util.ByteArray` to improve packing/unpacking operations. > > The PR also proposes adding a `ByteArrayLittleEndian` class for support for > little endian packing/unpacking. Here are some performance figures (TLDR: about 2% performance increase): Baseline (J21 master) [java] All test results: [java] Test(imageio.input.stream.tests.readFully(int[])) averaged 2.0089243986475606E9 bytes/sec [java] with 250x250, photo, byteArray, !useCache [java] Test(imageio.input.stream.tests.readLong) averaged 6.087925258517034E8 bytes/sec [java] with 250x250, photo, byteArray, !useCache Patch [java] All test results: [java] Test(imageio.input.stream.tests.readFully(int[]) averaged 2.0537614726652384E9 bytes/sec [java] with 250x250, photo, byteArray, !useCache [java] Test(imageio.input.stream.tests.readLong) averaged 6.227265050569915E8 bytes/sec [java] with 250x250, photo, byteArray, !useCache the `readFully(int[])` is a custom benchmark: iis.mark(); int[] array = new int[8]; do { if (pos + 4*8 > length) { iis.reset(); iis.mark(); pos = 0; } iis.readFully(array, 0, 8); pos += 4*8; } while (--numReps >= 0); Tests were run on a Mac M1 aarch64 machine. ------------- PR: https://git.openjdk.org/jdk/pull/12204