[ 
https://issues.apache.org/jira/browse/PDFBOX-2727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14376818#comment-14376818
 ] 

Petr Slaby commented on PDFBOX-2727:
------------------------------------

Note: In the PDResources constructor, I have noticed a "todo" comment stating 
that PDResources should be instantiated and cached on a "per COSDictionary" 
base, indicating that a proper caching solution might be more than my simple 
patch. Indeed, the cached color space instances should rather be bound to 
COSDictionary than to PDResources as multiple PDResources instances are created 
for a single COSDictionary.

Also, I have tried to cache also fonts created from font resources in the same 
way, but without any noticeable performance gain in my test suite.

> Cache color space instances
> ---------------------------
>
>                 Key: PDFBOX-2727
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2727
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Rendering
>    Affects Versions: 2.0.0
>            Reporter: Petr Slaby
>            Priority: Minor
>         Attachments: 000435.pdf, PDResources.java.patch
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to