RFR: 8292937: Improve performance of some read operations of RandomAccessFile
Сергей Цыпанов
duke at openjdk.org
Fri Aug 26 12:10:59 UTC 2022
On Fri, 26 Aug 2022 01:49:06 GMT, Quan Anh Mai <duke at openjdk.org> wrote:
>>> Maybe you can modify the read0 method to receive a width parameter additionally.
>>
>> @merykitty sorry, I don't get it. We already have `readBytes0()` returning array. Why do we need to add a new param to `read0`?
>
> @stsypanov `readBytes0` reads an arbitrary number of bytes and writes them to the given buffer. What I mean here is to have `read0` read 1, 2, 4 or 8 bytes then extend the result to a `jlong`, remove the need to write the result in an array.
@merykitty Done. The new results are:
Benchmark (kiloBytes) Mode Cnt Score Error Units
RandomAccessFileReadBenchmark.readInt 1 avgt 60 340,514 ± 11,205 us/op
RandomAccessFileReadBenchmark.readInt 5 avgt 60 1244,474 ± 40,376 us/op
RandomAccessFileReadBenchmark.readLong 1 avgt 60 237,004 ± 13,055 us/op
RandomAccessFileReadBenchmark.readLong 5 avgt 60 641,820 ± 4,896 us/op
RandomAccessFileReadBenchmark.readShort 1 avgt 60 542,874 ± 3,304 us/op
RandomAccessFileReadBenchmark.readShort 5 avgt 60 2166,878 ± 30,491 us/op
-------------
PR: https://git.openjdk.org/jdk/pull/10031
More information about the core-libs-dev
mailing list