RFR: 8300979: Lazily initialize (byte, char)arr in java.io.DataInputStream [v4]

Per Minborg pminborg at openjdk.org
Tue Mar 28 08:13:34 UTC 2023


On Tue, 28 Mar 2023 07:21:15 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR proposed to lazily initialize the scratch arrays only if/when needed.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use zero-lenght arrays rather than null

With the new non-null proposal and on my Mac M1, I get:

Baseline:

Benchmark                     Mode  Cnt  Score   Error  Units
DataInputStreamTest.readChar  avgt   20  5.077 ± 0.052  us/op
DataInputStreamTest.readInt   avgt   20  2.630 ± 0.014  us/op


PR (updated version):

Benchmark                     Mode  Cnt  Score   Error  Units
DataInputStreamTest.readChar  avgt   20  5.052 ± 0.028  us/op
DataInputStreamTest.readInt   avgt   20  2.615 ± 0.022  us/op


So, on my platform, the performance is unchanged.

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

PR Comment: https://git.openjdk.org/jdk/pull/13121#issuecomment-1486399781


More information about the core-libs-dev mailing list