commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uli Bubenheimer (JIRA)" <>
Subject [jira] [Commented] (IO-355) IOUtils copyLarge() and skip() methods are performance hogs
Date Wed, 31 Oct 2012 21:31:14 GMT


Uli Bubenheimer commented on IO-355:

Was referring to the wrong methods. I meant the copyLarge() methods that call IOUtils.skip()
- Javadoc should say that the skip will not do a seek and may be slower than they expect.

Preferably I hope you will consider changing the methods to have them call the InputStream.skip()
or Reader.skip() directly - I bet that 99.99% of the users of these methods are not interested
in the redefined skip() contract, but want convenient methods to copy things from an input
to an output while skipping some data. They are most likely not interested in getting a bad
deal on performance.

Or add copyLargeFast() methods or something similar.

> IOUtils copyLarge() and skip() methods are performance hogs
> -----------------------------------------------------------
>                 Key: IO-355
>                 URL:
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.3, 2.4
>            Reporter: Uli Bubenheimer
> IOUtils.skip(InputStream, long) and IOUtils.skip(Reader, long) have the worst possible
performance as they always use read() on the input instead of using skip(). In many cases,
using skip() from a subclass of InputStream is much faster than read(), as the skip() can
be implemented via a disk seek.
> The IOUtils.skip() methods are used in the read() methods of IOUtils and their similarly
named siblings, so they tend to bring down the performance of all reads that involve a skip.
> Case in point: I have observed this performance degradation with Java 7 on Windows 7.
A series of consecutive reads on a large file on disk that involved skips changed my performance
from 30 secs as my baseline to 10 minutes after starting to use

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message