[ 
https://issues.apache.org/jira/browse/IO-305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13232219#comment-13232219
 ] 

Manoj Mokashi commented on IO-305:
----------------------------------

I tested copying a 500MB tar archive with diffent buffersizes, and it does make 
a difference.
e.g. buffersize => time in millis: 
4096=>129954,*16=>71734,*64=91328
4096=>120406,*16=>80219,*64=69687

btw, accessing buffer.length inside the loop seems to affect performance for 
bigger lengths.
As seen in the 1st statistics, the *64 method actually takes longer than *16.
In the 2nd set i have used a buffersize var outside the loop as its constant.
I guess the results will vary as per avail memory, OS, disk types etc.
But it does make a difference to specify buffer size.

wrt IO-308, i agree that passing a buffer would be even better.

                
> New copy() method in IOUtils that takes additional offset, length and 
> buffersize arguments
> ------------------------------------------------------------------------------------------
>
>                 Key: IO-305
>                 URL: https://issues.apache.org/jira/browse/IO-305
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>            Reporter: Manoj Mokashi
>            Priority: Minor
>             Fix For: 2.2
>
>         Attachments: IOUtils.java, IOUtilsTest.java
>
>
>     /**
>      * Copy from input to output stream
>      * @param is : input stream
>      * @param os : output stream
>      * @param offset : number of bytes to skip from input before copying
>      *         -ve values are ignored
>      * @param len : number of bytes to copy. -1 means all
>      * @param bufferSize : buffer size to use for copying
>      * @throws IOException
>      */
>     public static void copy( InputStream is, OutputStream os, int offset, int 
> len, int bufferSize) throws IOException
>        

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to