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

unnecessary linear searches in "CFFParser.Format0FDSelect.getFd"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.1
    • 1.8.0
    • None

    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

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

            Dates

              Created:
              Updated:
              Resolved: