8227080: (fs) Files.newInputStream(...).skip(n) is slow
Florian Weimer
fweimer at redhat.com
Wed Jul 3 14:11:23 UTC 2019
* Brian Burkhalter:
> https://bugs.openjdk.java.net/browse/JDK-8227080
> http://cr.openjdk.java.net/~bpb/8227080/webrev.00/
>
> This patch overrides ChannelInputStream.skip(long) to use
> SeekableByteChannel.position(long) if the ReadableByteChannel instance
> is a SeekableByteChannel. The performance improvement on my dev
> machine for skipping the first 2 GB of a local file is about 3.6 x
> 10^4.
Doesn't this need a fallback in case the seek operation fails? I think
you can have FileChannels which are not seekable in practice, e.g. if
the file is actually a FIFO.
Thanks,
Florian
More information about the nio-dev
mailing list