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

Cache color space instances

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.0
    • 2.0.0
    • Rendering
    • None

    Description

      I have a PDF from a customer which contains a lot of calls of SetNonStrokingColorSpace and SetStrokingColorSpace. Each time, an embedded color profile resource is loaded via ICC_Profile.getInstance(InputStream). I have attempted to cache the result in PDResources.java as shown in the attached patch. For this particular PDF, this change improves the performance of PDFToImage from 27 seconds down to 5 seconds (the PDF has two pages). I cannot share the customer PDF, so I have attempted to find a similar free one. Unfortunately, in my test suite, I did not find anything with a comparable improvement. The best example I found is in the attached PDF. There the improvement is from 4.9 seconds without caching to 4.1 with caching.

      Attachments

        1. PDResources.java.patch
          2 kB
          Petr Slaby
        2. 000435.pdf
          825 kB
          Petr Slaby

        Issue Links

          Activity

            People

              jahewson John Hewson
              pslabycz Petr Slaby
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: