RFR: 8278166: java/nio/channels/Channels/TransferTo.java timed out

Brian Burkhalter bpb at openjdk.java.net
Fri Dec 3 23:09:12 UTC 2021


On Fri, 3 Dec 2021 22:57:53 GMT, Lance Andersen <lancea at openjdk.org> wrote:

>> In the `testMoreThanTwoGB()` sub-test, only fill the last section of the file with random data in order to reduce test execution time.
>
> test/jdk/java/nio/channels/Channels/TransferTo.java line 150:
> 
>> 148:             try {
>> 149:                 // create (hopefully sparse) file less than 2GB in size
>> 150:                 final long initLen = (2*1024 - 1)*BYTES_PER_WRITE;
> 
> Perhaps consider clarifying the comment for the initLen calculation 
> 
> I do suspect the use of RandomAccessFile improves the throughput here

I shall clean up the constants in the next revision.

A crude measurement showed that the execution time of `testMoreThanTwoGB()` was cut in half by this change. This sub-test is the slowest `@Test` in the test.

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

PR: https://git.openjdk.java.net/jdk/pull/6707


More information about the nio-dev mailing list