RFR: 8274112: (fc) Tune FileChannel.transferTo()

Brian Burkhalter bpb at openjdk.java.net
Wed Sep 22 20:07:26 UTC 2021


On Wed, 22 Sep 2021 01:25:37 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Please consider this patch which would improve the performance of
> `FileChannel.transferTo()` on macOS and Windows.

The second commit refactored `FileChannelImpl` to use `transferToFileChannel()` interposed between the direct and trusted paths. The performance measurements are little changed:

Benchmark                    (length)   Mode  Cnt       Score      Error  Units
TransferTune.transferToFC        1000  thrpt   10  287559.646 ± 3136.563  ops/s
TransferTune.transferToFC       10000  thrpt   10  238028.996 ± 3759.595  ops/s
TransferTune.transferToFC      100000  thrpt   10   50048.757 ± 1462.758  ops/s
TransferTune.transferToFC      500000  thrpt   10   11642.157 ±   99.617  ops/s
TransferTune.transferToFC     1000000  thrpt   10    5950.070 ±   54.328  ops/s
TransferTune.transferToFC    10000000  thrpt   10     363.774 ±    3.560  ops/s
TransferTune.transferToFC   100000000  thrpt   10      32.454 ±    0.166  ops/s
TransferTune.transferToFC   500000000  thrpt   10       6.506 ±    0.175  ops/s
TransferTune.transferToFC  1000000000  thrpt   10       3.127 ±    0.121  ops/s
TransferTune.transferToFC  2000000000  thrpt   10       1.555 ±    0.084  ops/s
TransferTune.transferToFC  4000000000  thrpt   10       0.747 ±    0.101  ops/s

the `transfer_read_write()` functions were _not_ changed as yet to return a positive `tw` if either the read or the write fails. The `UNSUPPORTED_SUBCASE` was removed.

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

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


More information about the nio-dev mailing list