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?

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.