RFR: 8298639: Perform I/O operations in bulk for RandomAccessFile [v3]

Per Minborg pminborg at openjdk.org
Thu Dec 15 10:11:06 UTC 2022


On Thu, 15 Dec 2022 09:56:37 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR suggests improving performance for read and write operations for the longer primitives in `RandomAccessFile`.
>> 
>> These improvements would also propagate to other JDK classes relying on these improved `RandomAccessFile` operations.
>
> Per Minborg has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - Improve benchmarks
>  - Add benchmark
>  - Use Bits instead of custom code

Before (baseline):


Benchmark                             (kiloBytes)  Mode  Cnt      Score     Error  Units
RandomAccessFileBenchmark.readInt               1  avgt   10    425,047 ?   4,391  us/op
RandomAccessFileBenchmark.readInt               5  avgt   10   2116,130 ?  33,072  us/op
RandomAccessFileBenchmark.readLong              1  avgt   10    425,847 ?   3,115  us/op
RandomAccessFileBenchmark.readLong              5  avgt   10   2118,740 ?  10,773  us/op
RandomAccessFileBenchmark.readShort             1  avgt   10    425,054 ?   6,808  us/op
RandomAccessFileBenchmark.readShort             5  avgt   10   2198,914 ? 105,192  us/op
RandomAccessFileBenchmark.writeInt              1  avgt   10   2259,429 ? 111,989  us/op
RandomAccessFileBenchmark.writeInt              5  avgt   10  10927,965 ? 579,343  us/op
RandomAccessFileBenchmark.writeLong             1  avgt   10   2181,974 ? 136,907  us/op
RandomAccessFileBenchmark.writeLong             5  avgt   10  11319,550 ? 408,315  us/op
RandomAccessFileBenchmark.writeShort            1  avgt   10   2283,893 ? 122,679  us/op
RandomAccessFileBenchmark.writeShort            5  avgt   10  11397,006 ? 543,862  us/op


After:


Benchmark                             (kiloBytes)  Mode  Cnt     Score     Error  Units
RandomAccessFileBenchmark.readInt               1  avgt   10   132,385 ?   2,416  us/op
RandomAccessFileBenchmark.readInt               5  avgt   10   655,828 ?  14,442  us/op
RandomAccessFileBenchmark.readLong              1  avgt   10    66,383 ?   0,763  us/op
RandomAccessFileBenchmark.readLong              5  avgt   10   329,242 ?   9,269  us/op
RandomAccessFileBenchmark.readShort             1  avgt   10   263,399 ?   4,584  us/op
RandomAccessFileBenchmark.readShort             5  avgt   10  1322,607 ?  27,811  us/op
RandomAccessFileBenchmark.writeInt              1  avgt   10   535,133 ?  24,860  us/op
RandomAccessFileBenchmark.writeInt              5  avgt   10  2701,959 ? 115,069  us/op
RandomAccessFileBenchmark.writeLong             1  avgt   10   268,175 ?  13,810  us/op
RandomAccessFileBenchmark.writeLong             5  avgt   10  1313,634 ?  33,461  us/op
RandomAccessFileBenchmark.writeShort            1  avgt   10  1076,690 ?  17,407  us/op
RandomAccessFileBenchmark.writeShort            5  avgt   10  5383,567 ? 250,833  us/op


![image](https://user-images.githubusercontent.com/7457876/207831696-95c93d88-11e1-49be-949f-8fb39537425f.png)

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

PR: https://git.openjdk.org/jdk/pull/11644


More information about the core-libs-dev mailing list