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

Alan Bateman alanb at openjdk.org
Thu Dec 15 15:04:07 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

src/java.base/share/classes/java/io/RandomAccessFile.java line 60:

> 58:  * {@code IOException} may be thrown if the stream has been closed.
> 59:  *
> 60:  * @implNote This class is not thread safe.

I don't think this should be an implNote. Maybe for a different issue/PR is that the class description probably needs a paragraph to say that a RAF is not thread safe and requires appropriate synchronization when used by concurrent threads. This leads to discussion about a FileChannel obtained from a RAF as FileChannel defines read/write methods that support cases where threads need to access different parts of a file at the same time. There is a lot more to say on this topic and probably best to keep it separate.

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

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


More information about the core-libs-dev mailing list