[ 
https://issues.apache.org/jira/browse/IO-515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Gregory resolved IO-515.
-----------------------------
    Resolution: Fixed

Thank you for your report.

Note: Part of your analysis is incorrect, the class 
{{DeferredFileOutputStream}} uses Commons IO's own implementation of 
{{ByteArrayOutputStream}} which has a default allocation size of 1024 bytes.

In Git master. Please verify and close.

Closes #22.

> Allow Specifying Initial Buffer Size of DeferredFileOutputStream
> ----------------------------------------------------------------
>
>                 Key: IO-515
>                 URL: https://issues.apache.org/jira/browse/IO-515
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Streams/Writers
>            Reporter: Brett Lounsbury
>            Assignee: Gary Gregory
>
> Right now the DeferredFileOutputStream uses a ByteArrayOputStream for its in 
> memory buffer.  It simply does new ByteArrayOutputStream() which initializes 
> the ByteArrayOutputStream's internal buffer to 32B.  In the case of large 
> threshold values for in-memory buffering this can become very inefficient 
> (Requiring 15 array doubling operations to grow to 1MB and producing an extra 
> 1MB of garbage along the way).
> By allowing the user to specify the initial buffer size we allow them to tune 
> how many times the array will need to double to something that meets their 
> application's needs.
> In our testing we had an application that used a DeferredFileOutputStream to 
> capture incoming data.  Once that data was fully captured it did some fairly 
> CPU intensive processing of the data.  The ByteArrayOutputStream used by 
> DeferredFileOutputStream was using 60% of our host's CPU simply on array 
> copying.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to