RFR: 8274112: (fc) Tune FileChannel.transferTo() [v6]
Roger Riggs
rriggs at openjdk.java.net
Fri Apr 29 15:33:56 UTC 2022
On Thu, 28 Apr 2022 00:08:18 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Please consider this patch which would improve the performance of
>> `FileChannel.transferTo()` on macOS and Windows.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8274112: Revert all changes except mapped transfer threshold
test/jdk/java/nio/channels/FileChannel/TransferToChannel.java line 126:
> 124: for (int i=0; i<size; i++)
> 125: if (incoming[i] != expected[i])
> 126: throw new RuntimeException("Data corrupted");
Perhaps `if (!Arrays.equals(incoming, 0, size, expected, 0, size))...`
test/jdk/java/nio/channels/FileChannel/TransferToChannel.java line 157:
> 155: private static void transferFileDirectly() throws Exception {
> 156: outFile.delete();
> 157: FileOutputStream fos = new FileOutputStream(outFile);
Can try-with-resources be used here for both fos and out?
test/jdk/java/nio/channels/FileChannel/TransferToChannel.java line 169:
> 167: pos += bytesTransferred;
> 168: else
> 169: throw new Exception("transfer failed");
Including some position information in the exception would help diagnose, especially with intermittent failures, if they happen.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5623
More information about the nio-dev
mailing list