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

Michael McCandless commented on PDFBOX-1159:
--------------------------------------------

Thanks Andreas!

On the Encoding.java change: you're right, it was unrelated to speeding up 
LZWFilter.  But I think it's still worth committing: it saves a redundant call 
to getName.

It was just a small code improvement I came across while digging into the 
LZWFilter...
                
> Speed up LZWFilter decoding
> ---------------------------
>
>                 Key: PDFBOX-1159
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1159
>             Project: PDFBox
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>            Assignee: Andreas Lehmkühler
>            Priority: Minor
>             Fix For: 1.7.0
>
>         Attachments: PDFBOX-1159.patch
>
>
> I noticed that the LZW decoder performance can be improved: it's
> allocating a new byte[] for every byte it visits in the stream.  This
> is actually an O(N^2) cost, but N is typically fairly small.
> I changed LZWDictionary to use its own private growable byte[] to
> accumulate each added byte.  I also changed it to not pre-enroll all
> initial (0-255) codes, but instead add it (lazily) on demand if the
> code is used.
> I also randomized the TestFilters test, and mixed in some
> "more predictable" patterns, so we get better testing of the filters.
> If the test fails it prints the seed used for the random numbers, so
> we can reproduce the failure.

--
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