RFR: 8265891: (ch) InputStream returned by Channels.newInputStream should override transferTo [v13]
Markus KARG
duke at openjdk.java.net
Fri Dec 17 15:54:32 UTC 2021
On Thu, 12 Aug 2021 01:04:29 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Markus KARG has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Draft: Eliminated duplicate code using lambda expressions
>> - Draft: Use blocking mode also for target channel
>
> src/java.base/share/classes/sun/nio/ch/ChannelInputStream.java line 249:
>
>> 247: }
>> 248:
>> 249: private static long transfer(ReadableByteChannel src, WritableByteChannel dst) throws IOException {
>
> Does this method have a measurable improvement in performance over `InputStream.transferTo()`?
Measured it today, here are the actual results:
Sandbox.transferTo thrpt 25 0,091 ± 0,011 ops/s -- using byte[] (original implementation)
Sandbox.transferTo thrpt 25 0,095 ± 0,012 ops/s -- using utility temporary buffer (my contribution)
Sandbox.transferTo thrpt 23 0,099 ± 0,012 ops/s -- FileChannel.transferTo(FileChannel)
The improvement of this method actually is approx. 4% on my Windows laptop, which I would say is worth to do it.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4263
More information about the nio-dev
mailing list