You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Sergey Vladimirov (JIRA)" <ji...@apache.org> on 2011/04/27 12:48:03 UTC

[jira] [Created] (PDFBOX-1005) Unnecessary filling new array with zeros in RandomAccessBuffer::write(byte[], int, int)

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


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

[jira] [Resolved] (PDFBOX-1005) Unnecessary filling new array with zeros in RandomAccessBuffer::write(byte[], int, int)

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-1005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler resolved PDFBOX-1005.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.6.0
         Assignee: Andreas Lehmkühler

I added the patch as proposed by Kevin Jackson in revision 1097910.

It really speeds the loading and the processing of a pdf up, e.g. the text extraction of the pdf 1.7 reference:

- before: loading 50 seconds, processing 90 seconds
- after: loading 9 seconds, processing 14 seconds

Thanks for the contribution

> 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
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.6.0
>
>         Attachments: RandomAccessBuffer.java
>
>   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

[jira] [Updated] (PDFBOX-1005) Unnecessary filling new array with zeros in RandomAccessBuffer::write(byte[], int, int)

Posted by "Kevin Jackson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-1005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Jackson updated PDFBOX-1005:
----------------------------------

    Attachment: RandomAccessBuffer.java

> 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
>         Attachments: RandomAccessBuffer.java
>
>   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

[jira] [Updated] (PDFBOX-1005) Unnecessary filling new array with zeros in RandomAccessBuffer::write(byte[], int, int)

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-1005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler updated PDFBOX-1005:
---------------------------------------

    Priority: Major  (was: Trivial)

Set priority to Major because of the performance regression

> 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
>         Attachments: RandomAccessBuffer.java
>
>   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

[jira] [Commented] (PDFBOX-1005) Unnecessary filling new array with zeros in RandomAccessBuffer::write(byte[], int, int)

Posted by "Kevin Jackson (JIRA)" <ji...@apache.org>.
    [ 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