RFR: 8274113: (fc) Tune FileChannel.transferFrom() [v2]

Brian Burkhalter bpb at openjdk.java.net
Wed May 11 17:37:45 UTC 2022


On Wed, 11 May 2022 13:07:21 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> Overall I think this looks good. It would be useful to add some performance data to the PR to demonstrate the improvement.

Throughput on macOS showing the change due to the mapped transfer threshold:

Before (mapped transfer)

Benchmark                  (length)   Mode  Cnt      Score     Error  Units
TransferFrom.transferFrom      8000  thrpt   10  83171.694 ± 394.409  ops/s
TransferFrom.transferFrom     12000  thrpt   10  78985.812 ± 405.395  ops/s
TransferFrom.transferFrom     14000  thrpt   10  74194.782 ± 387.265  ops/s
TransferFrom.transferFrom     16000  thrpt   10  74117.711 ± 301.495  ops/s
TransferFrom.transferFrom     17000  thrpt   10  70074.672 ± 562.279  ops/s
TransferFrom.transferFrom     18000  thrpt   10  69862.113 ± 348.783  ops/s
TransferFrom.transferFrom     19000  thrpt   10  69742.800 ± 264.864  ops/s
TransferFrom.transferFrom     20000  thrpt   10  69017.441 ± 208.591  ops/s
TransferFrom.transferFrom     22000  thrpt   10  65326.088 ± 281.195  ops/s
TransferFrom.transferFrom     24000  thrpt   10  64996.134 ± 254.554  ops/s

After (read-write transfer up to 16K length)

Benchmark                  (length)   Mode  Cnt       Score      Error  Units
TransferFrom.transferFrom      8000  thrpt   10  178033.028 ± 1048.081  ops/s
TransferFrom.transferFrom     12000  thrpt   10   99595.963 ± 1044.993  ops/s
TransferFrom.transferFrom     14000  thrpt   10   97869.683 ±  548.820  ops/s
TransferFrom.transferFrom     16000  thrpt   10   94392.964 ±  827.057  ops/s
TransferFrom.transferFrom     17000  thrpt   10   67670.339 ±  735.683  ops/s
TransferFrom.transferFrom     18000  thrpt   10   68161.273 ±  384.360  ops/s
TransferFrom.transferFrom     19000  thrpt   10   68453.820 ±  632.199  ops/s
TransferFrom.transferFrom     20000  thrpt   10   68701.903 ± 1042.648  ops/s
TransferFrom.transferFrom     22000  thrpt   10   65713.451 ±  497.990  ops/s
TransferFrom.transferFrom     24000  thrpt   10   66525.251 ± 1017.672  ops/s

The threshold could probably be a little higher but is left at 16K for consistency with `transferTo()`.

Throughput on Linux showing the change due to direct transfer:

Before (mapped transfer)

Benchmark                  (length)   Mode  Cnt      Score      Error  Units
TransferFrom.transferFrom     16384  thrpt    5  95885.876 ± 1153.982  ops/s
TransferFrom.transferFrom    131072  thrpt    5  30699.784 ±  653.334  ops/s
TransferFrom.transferFrom   1000000  thrpt    5   6840.268 ±  162.586  ops/s

After (copy_file_range())

Benchmark                  (length)   Mode  Cnt       Score      Error  Units
TransferFrom.transferFrom     16384  thrpt    5  236198.847 ± 2070.598  ops/s
TransferFrom.transferFrom    131072  thrpt    5   59197.335 ± 1596.413  ops/s
TransferFrom.transferFrom   1000000  thrpt    5    8135.444 ±  758.260  ops/s

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

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


More information about the nio-dev mailing list