Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 067AFD6E3 for ; Wed, 31 Oct 2012 20:47:13 +0000 (UTC) Received: (qmail 57402 invoked by uid 500); 31 Oct 2012 20:47:12 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 57305 invoked by uid 500); 31 Oct 2012 20:47:12 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 57266 invoked by uid 99); 31 Oct 2012 20:47:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2012 20:47:12 +0000 Date: Wed, 31 Oct 2012 20:47:12 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: <1631711187.52924.1351716432522.JavaMail.jiratomcat@arcas> In-Reply-To: <767287737.51026.1351700832285.JavaMail.jiratomcat@arcas> Subject: [jira] [Commented] (IO-355) IOUtils read() and skip() methods are performance hogs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/IO-355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488214#comment-13488214 ] Sebb commented on IO-355: ------------------------- bq. Make sure to change the javadoc for all the read and readFully methods as well Did you mean skip and skipFully? The read and readFully methods use the implementation provided, so I don't see how they can be less performant. bq. Seems to set a bad precedent for usability of Apache Commons. The point of the IOUtils#skip() methods is to guarantee that the correct number of bytes/chars is skipped. This does not not appear to be possible using the subclass skip() implementations for the reasons already given. > IOUtils read() and skip() methods are performance hogs > ------------------------------------------------------ > > Key: IO-355 > URL: https://issues.apache.org/jira/browse/IO-355 > 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 IOUtils.read(). -- 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: http://www.atlassian.com/software/jira