On Wed, 8 Nov 2023 11:55:22 GMT, Glavo <[email protected]> wrote:
> This PR significantly speeds up decompressing resources in Jimage while
> significantly reducing temporary memory allocations in the process.
>
> This will improve startup speed for runtime images generated using `jlink
> --compress 1` and `jlink --compress 2` .
>
> I generated a runtime image containing javac using `jlink --compress 1
> --add-modules jdk.compiler` and tested the time it took to compile a simple
> HelloWorld program 20 times using `perf stat -r20 javac
> /dev/shm/HelloWorld.java`, this PR reduces the total time taken from 17830ms
> to 13598ms (31.12% faster).
src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java line 349:
> 347:
> 348: int getStringMUTF8(int offset, byte[] bytesOut, int bytesOutOffset) {
> 349: if (offset < 0 || offset >= strings.limit()) {
Can we use `Objects::checkIndex` here instead?
src/java.base/share/classes/jdk/internal/jimage/decompressor/StringSharingDecompressor.java
line 94:
> 92: int offset, long originalSize) throws
> IOException {
> 93: if (originalSize > Integer.MAX_VALUE) {
> 94: throw new OutOfMemoryError("Required array size too large");
Is this the correct exception type?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16556#discussion_r1399517646
PR Review Comment: https://git.openjdk.org/jdk/pull/16556#discussion_r1399518707