RFR: 8278268 - (ch) InputStream returned by Channels.newInputStream should have fast path for FileChannel targets [v17]
Markus KARG
duke at openjdk.org
Mon Dec 12 20:45:08 UTC 2022
On Mon, 12 Dec 2022 20:04:40 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> Which platform was used to generate the performance data?
Ubuntu 20.04.5 LTS (x86_64)
> Also what was the source stream?
`Channels.newInputStream(Channels.newChannel(new ByteArrayInputStream(byte[size])))`
> Just asking as FileChannel.transferFrom uses copy_file_range for file-to-file (Linux), memory mapping for file-to-file, and a copy loop for other cases.
Yes, but apparently `FileChannel.transferFrom` is doing such copy loop more efficient than `InputStream.transferTo`'s loop.
> In any case, the changes to ChannelInputStream.transferTo does the right thing. Most of the change in the PR is the tests. I don't have time to look at those closely right now but Lance or Brian might have cycles.
Thanks. Please remember that the code was already reviewed and test-driven by Lance a year ago and just was held back due to the bug in Windows's Socket implementation, *discovered by* this PR's test.
-------------
PR: https://git.openjdk.org/jdk/pull/6711
More information about the nio-dev
mailing list