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

Kevin Jackson commented on PDFBOX-1005:
---------------------------------------

RandomAccessBuffer has bigger problems then just this zeroing the array.
When the buffer needs to grow, a constant amount is added which results in n^2 
behavior.
Therefore the buffer should be doubled when the buffer needs to grow.
My first fix to this problem was similar to ByteArrayOutputStream which has a 
bad bug when the buffer exceeds 1G bytes.
Attached is my fix.
I would raise the priority of this bug from trivial.  Going from PDFBox 1.4 to 
1.5 caused run times of a few minutes to balloon to days because of this issue. 


> Unnecessary filling new array with zeros in RandomAccessBuffer::write(byte[], 
> int, int)
> ---------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-1005
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1005
>             Project: PDFBox
>          Issue Type: Improvement
>    Affects Versions: 1.5.0
>            Reporter: Sergey Vladimirov
>            Priority: Trivial
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> it is not required to fill new array with zeros, because it's done by JVM

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to