Adrian Nistor created PDFBOX-1464:
-------------------------------------

             Summary: unnecessary linear searches in 
"CFFParser.Format0FDSelect.getFd"
                 Key: PDFBOX-1464
                 URL: https://issues.apache.org/jira/browse/PDFBOX-1464
             Project: PDFBox
          Issue Type: Bug
    Affects Versions: 1.7.1
            Reporter: Adrian Nistor
         Attachments: patch.diff

The problem appears in PDFBox 1.7.1 and in revision 1415855.  I
attached a small patch that fixes it.

In method "CFFParser.Format0FDSelect.getFd", the linear search over
the map keys "keys" is unnecessary when the "Map charString" does not
contain the key.  The attached patch first checks if the map contains
the key, which is a fast operation for a LinkedHashMap like
"charString".

Moreover, I think the linear search can be avoided altogether by
storing the indices directly in the Map (the type of the values would
change from byte[] to the pair <byte[],index>).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to