[ https://issues.apache.org/jira/browse/PDFBOX-2117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14018828#comment-14018828 ]
Petr Slaby commented on PDFBOX-2117: ------------------------------------ I have measured the times needed when calling PDFToImage -resolution 300 <filename> with the pdf files you mentioned. I have used System.currentTimeMillis() for the measurement. Here are the results: ||File||Original||Patched|| |Pdf Graphiland Tp.pdf |141,7s|45,8s| |missing_image.pdf|410,9s|248,3s| |asy-shade.pdf|2.3s|2.0s| |color_gradient.pdf|77,734s|77,923s (not a single cache hit with this one)| |shading_pattern.pdf|78,5s|54,5s| |Shading2Function2text.pdf|67,7s|4,7s| As for your student - sorry for that, I must admit that I did not search the issues before diving into the profiler results. I have spent one and half day with this so far, mostly waiting for the test run to complete. I hope I did not spoil the whole summer of coding with that. Compare my results with opening the file in Acrobat Reader - there must be a lot to do still. (I know it is not comparable, but that is what my customers always do). Radial shading is completely resistant to caching of the values, I did not get any improvement on that. I imagine someone good in math should be able to implement the following idea. The axial shading is a gradient following a line - horizontal, vertical or diagonal. Radial shading has a similar line starting in the middle and going to the border of the circle. It should be possible to (pre)compute just the values on this line and then, with each request in getRaster(), just find the right position on the scan line and get the values from it. Do all the math in integers rather than floats and you should get much closer to the "nothing to optimize" state. > AxialShadingContext is slow > --------------------------- > > Key: PDFBOX-2117 > URL: https://issues.apache.org/jira/browse/PDFBOX-2117 > Project: PDFBox > Issue Type: Improvement > Reporter: Petr Slaby > Attachments: AxialShading.patch, Shading2Function2text.pdf, > asy-shade.pdf, color_gradient.pdf, shading_pattern.pdf > > > AxialShadingContext#getRaster() is on top of profiler hot spots in documents > that use an axial shading. Inside it, the slowest part is calling > PDColorSpaceRGB#toRGB() and PDFunctionType3#eval() (in this order). > -- This message was sent by Atlassian JIRA (v6.2#6252)