Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Clipping is slow in Java

28 sec read

In general, Java has developed into a fairly nifty language, with a good execution speed. However, some operations are still disappointing in comparison to other languages…

I have been investigating a PDF file to see why it is slow on our PDF renderer. Running it in my favourite Java Profiler showed that it spent a lot of time in the setClip command, even though I was setting the clip to a simple Rectangle. I can understand a hit on a complex shape but not a simple Shape. Optimising the code to reduce calls to setClip() has speeded up that PDF file by an order of magnitude.

So I  am now working though my code to ensure that I call setClip() very sparingly. Are there any Java language features which you find annoyingly slow?



Do you need to solve any of these problems in Java?

Convert PDF to HTML5
Convert PDF to HTML5
Convert PDF to SVG
Convert PDF to SVG
Convert PDF Forms to HTML5 Forms
View Forms in the browser
Java PDF Reader and Viewer
View PDF Documents
Convert PDF to image
Convert PDF to image
Extract Text from PDF
Extract Text from PDF
Read/Write images in Java
Read/Write images
Replace ImageIO
Replace ImageIO
Convert Image to PDF
Convert Image to PDF
Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2021. All rights reserved.