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


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