Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-1464

unnecessary linear searches in "CFFParser.Format0FDSelect.getFd"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.1
    • Fix Version/s: 1.8.0
    • Component/s: None
    • Labels:

      Description

      The problem appears in PDFBox 1.7.1 and in revision 1415855. I
      attached a two-line 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>).

        Attachments

        1. patch.diff
          0.6 kB
          Adrian Nistor

          Activity

            People

            • Assignee:
              lehmi Andreas Lehmkühler
              Reporter:
              adriannistor Adrian Nistor
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: