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

Andreas Lehmkühler resolved PDFBOX-5799.
----------------------------------------
    Fix Version/s: 4.0.0
                   3.0.3 PDFBox
       Resolution: Fixed

I've fixed the regression so that 3.x and 4.x are as fast as 2.x.

The origin implementation of SequenceRandomAccessRead.seek(long) simply starts 
with the first stream when looking for the correct stream. It checks if the new 
position is between the start and the end position of a stream starting with 
the first stream of the sequence. This works well for typical content streams 
holding a couple of single streams. But when it comes to thousands of single 
streams, it doesn't perform very well.
The new implementation determines if the new position is before or after the 
current position, Depending o that the search for the correct streams goes 
forward/backward starting with the current one

> Page with thousands of content streams takes extremely long to render or 
> extract
> --------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5799
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5799
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering, Text extraction
>    Affects Versions: 3.0.2 PDFBox
>            Reporter: Tilman Hausherr
>            Assignee: Andreas Lehmkühler
>            Priority: Major
>              Labels: performance
>             Fix For: 4.0.0, 3.0.3 PDFBox
>
>
> As reported by Erik Branks on the mailing list:
> {quote}when attempting text extraction from the PDF at 
> [https://d-nb.info/1324982411/34] , either using PDFBox 3.0.0 or PDFBox 
> 4.0.0-SNAPSHOT, the extraction uses about 1,8 GB heap memory and does not 
> seem to terminate. I cancelled the extraction attempt after roughly 20 
> minutes. Is this another bad PDF or is there a bug in PDFBox?{quote}
> This happens with pages 230 and 231 (maybe others). Both have thousands of 
> content streams in the content stream array. The profiler suggests that most 
> time is spent in {{SequenceRandomAccessRead.seek()}}.
> Rendering page 230 with PDFBox 2.0: 50 seconds
> Rendering page 230 with PDFBox trunk: 2990 seconds
> Rendering page 231 with PDFBox trunk: 4798 seconds 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to