On Thu, 9 Jun 2022 18:38:18 GMT, Brian Burkhalter <b...@openjdk.org> wrote:
>> Modify native multi-byte read-write code used by the `java.io` classes to >> limit the size of the allocated native buffer thereby decreasing off-heap >> memory footprint and increasing throughput. > > Brian Burkhalter has updated the pull request with a new target base due to a > merge or a rebase. The incremental webrev excludes the unrelated changes > brought in by the merge/rebase. The pull request contains seven additional > commits since the last revision: > > - Merge > - 6478546: Add break in write loop on ExceptionOccurred > - Merge > - 6478546: Clean up io_util.c > - Merge > - 6478546: Decrease malloc'ed buffer maximum size to 64 kB > - 6478546: FileInputStream.read() throws OutOfMemoryError when there is > plenty available The following benchmark results are for commit e6f3b4574b1c49955e5acaca618a3083eb132e05 with 5 warmup iterations of 5 seconds each, followed by 10 measurement iterations of 10 seconds each on a MacBookPro16,1. FileInputStream.read(byte[]) Score (ops/s) (length) Master Branch 16384 5850.383 ± 220.209 5805.952 ± 187.870 32768 5781.410 ± 345.939 5807.587 ± 515.808 100000 5444.167 ± 409.680 5273.988 ± 159.652 500000 3748.413 ± 88.505 3803.577 ± 256.442 1000000 2647.356 ± 145.245 2700.523 ± 97.717 1048576 2759.337 ± 362.618 2631.779 ± 45.971 10485760 338.840 ± 2.706 392.126 ± 2.59 251503002 10.626 ± 0.024 20.165 ± 0.091 524288000 5.134 ± 0.024 9.826 ± 0.068 1000000000 1.806 ± 0.014 5.194 ± 0.015 FileOutputStream.write(byte[]) Score (ops/s) (length) Master Branch 16384 2736.489 ± 31.547 2599.203 ± 79.392 32768 2656.471 ± 72.597 2523.470 ± 158.460 100000 2476.514 ± 46.392 2225.597 ± 442.285 500000 1606.205 ± 487.787 1281.550 ± 413.797 1000000 1125.265 ± 13.969 812.184 ± 232.23 1048576 1098.608 ± 13.528 816.657 ± 218.112 10485760 136.867 ± 2.310 153.137 ± 2.93 251503002 7.266 ± 0.026 10.546 ± 0.125 524288000 3.450 ± 0.016 3.880 ± 1.355 1000000000 1.178 ± 0.007 2.637 ± 0.505 The proposed change is approximately at parity with the current code base for smaller lengths, but has higher throughput for larger lengths, at least for reading. In all cases where the length is greater than or equal to 65536 (64 KiB) or is a multiple of 8192 (8 KiB), less native memory is allocated. ------------- PR: https://git.openjdk.org/jdk/pull/8235