RFR: 8304745: Lazily initialize byte[] in java.io.BufferedInputStream [v8]
Sergey Tsypanov
stsypanov at openjdk.org
Mon Mar 27 16:18:26 UTC 2023
On Fri, 24 Mar 2023 19:30:22 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:
>> By default `BufferedInputStream` is constructed with internal buffer with capacity 8192. In some cases this buffer is never used, e.g. when we call `IS.readNBytes()` or `IS.readAllBytes()` (relying on `BIS.read1()`) or when `BufferedInputStream` is cascaded.
>
> Sergey Tsypanov has updated the pull request incrementally with two additional commits since the last revision:
>
> - Merge remote-tracking branch 'origin/8304745' into 8304745
>
> # Conflicts:
> # test/micro/org/openjdk/bench/java/io/BufferedInputStreamBenchmark.java
> - 8304745: Fix line breaks
Comments added to benchmark.
make test TEST="micro:io.BufferedInputStreamBenchmark" MICRO="OPTIONS=-prof gc"
master
Benchmark (size) Mode Cnt Score Error Units
BufferedInputStreamBenchmark.readAllBytes 1024 avgt 20 7.278 ± 0.286 us/op
BufferedInputStreamBenchmark.readAllBytes:·gc.alloc.rate 1024 avgt 20 3377.138 ± 131.745 MB/sec
BufferedInputStreamBenchmark.readAllBytes:·gc.alloc.rate.norm 1024 avgt 20 25752.011 ± 0.001 B/op
BufferedInputStreamBenchmark.readAllBytes:·gc.count 1024 avgt 20 123.000 counts
BufferedInputStreamBenchmark.readAllBytes:·gc.time 1024 avgt 20 1085.000 ms
BufferedInputStreamBenchmark.readAllBytes 16384 avgt 20 13.538 ± 0.759 us/op
BufferedInputStreamBenchmark.readAllBytes:·gc.alloc.rate 16384 avgt 20 2901.305 ± 167.849 MB/sec
BufferedInputStreamBenchmark.readAllBytes:·gc.alloc.rate.norm 16384 avgt 20 41112.228 ± 0.013 B/op
BufferedInputStreamBenchmark.readAllBytes:·gc.count 16384 avgt 20 107.000 counts
BufferedInputStreamBenchmark.readAllBytes:·gc.time 16384 avgt 20 1012.000 ms
BufferedInputStreamBenchmark.readAllBytesCascade 1024 avgt 20 13.273 ± 0.729 us/op
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.alloc.rate 1024 avgt 20 2452.198 ± 136.123 MB/sec
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.alloc.rate.norm 1024 avgt 20 34064.020 ± 0.001 B/op
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.count 1024 avgt 20 93.000 counts
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.time 1024 avgt 20 1081.000 ms
BufferedInputStreamBenchmark.readAllBytesCascade 16384 avgt 20 24.633 ± 3.127 us/op
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.alloc.rate 16384 avgt 20 1943.798 ± 229.336 MB/sec
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.alloc.rate.norm 16384 avgt 20 49424.413 ± 0.052 B/op
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.count 16384 avgt 20 72.000 counts
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.time 16384 avgt 20 993.000 ms
8304745
Benchmark (size) Mode Cnt Score Error Units
BufferedInputStreamBenchmark.readAllBytes 1024 avgt 20 2.212 ± 0.038 us/op
BufferedInputStreamBenchmark.readAllBytes:·gc.alloc.rate 1024 avgt 20 7563.662 ± 135.402 MB/sec
BufferedInputStreamBenchmark.readAllBytes:·gc.alloc.rate.norm 1024 avgt 20 17552.003 ± 0.001 B/op
BufferedInputStreamBenchmark.readAllBytes:·gc.count 1024 avgt 20 339.000 counts
BufferedInputStreamBenchmark.readAllBytes:·gc.time 1024 avgt 20 691.000 ms
BufferedInputStreamBenchmark.readAllBytes 16384 avgt 20 3.127 ± 0.071 us/op
BufferedInputStreamBenchmark.readAllBytes:·gc.alloc.rate 16384 avgt 20 10034.809 ± 222.058 MB/sec
BufferedInputStreamBenchmark.readAllBytes:·gc.alloc.rate.norm 16384 avgt 20 32912.053 ± 0.001 B/op
BufferedInputStreamBenchmark.readAllBytes:·gc.count 16384 avgt 20 388.000 counts
BufferedInputStreamBenchmark.readAllBytes:·gc.time 16384 avgt 20 953.000 ms
BufferedInputStreamBenchmark.readAllBytesCascade 1024 avgt 20 2.521 ± 0.048 us/op
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.alloc.rate 1024 avgt 20 6678.812 ± 126.007 MB/sec
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.alloc.rate.norm 1024 avgt 20 17664.004 ± 0.001 B/op
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.count 1024 avgt 20 176.000 counts
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.time 1024 avgt 20 1049.000 ms
BufferedInputStreamBenchmark.readAllBytesCascade 16384 avgt 20 4.728 ± 0.905 us/op
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.alloc.rate 16384 avgt 20 6911.193 ± 1061.227 MB/sec
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.alloc.rate.norm 16384 avgt 20 33024.080 ± 0.015 B/op
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.count 16384 avgt 20 191.000 counts
BufferedInputStreamBenchmark.readAllBytesCascade:·gc.time 16384 avgt 20 1157.000 ms
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13150#issuecomment-1485425304
PR Comment: https://git.openjdk.org/jdk/pull/13150#issuecomment-1485427789
More information about the core-libs-dev
mailing list