You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Michael McCandless (Updated) (JIRA)" <ji...@apache.org> on 2011/11/05 15:46:51 UTC

[jira] [Updated] (PDFBOX-1159) Speed up LZWFilter decoding

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

Michael McCandless updated PDFBOX-1159:
---------------------------------------

    Attachment: PDFBOX-1159.patch

Patch.
                
> Speed up LZWFilter decoding
> ---------------------------
>
>                 Key: PDFBOX-1159
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1159
>             Project: PDFBox
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>            Priority: Minor
>         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