Monday 28 May 2007

Performance of Batik under Java 6.0

As I use it a lot, I tried to measure the possible boost of performance of Batik, the pure Java library which handle SVG files, under Java SE 6.0, compared to Java 5.0. I decide to create a small benchmark, similar to the one Dave Gilbert, the creator and maintainer of JFreeChart, did, some times ago.

To make it simple, I decided to benchmark the time spent by Batik from the parsing of the SVG file, to the rendering of the associated image on a JFrame. To measure the performance, I call the method 100 times (yes, maybe not enough times), and measure the elapsed time.

Finding good SVG images is not so simple, because time is not only linked to the size of the file, but also to what it contains (for example, complex renderings like gradients take much more time to compute).

And of course, I used Batik 1.7 Beta 1 and rebuilt it for Java 5.0, then 6.0, before doing all this.

Here are the results on my XP box:

Average performance boost is approx. 20%, this is good !!

For some more informations about the different SVG files that were used, they are all coming from the Batik samples library. You can get these samples either by downloading the snapshot here, or much simpler by getting them from the SVN viewer on the trunk here. For more informations about them:

  • asf-logo size is 100 Ko, and it uses a lot of gradients

  • batik3D size is 104 Ko

  • anne size is 86 Ko

  • strokeFont size is 70 Ko

  • moonPhases is 95 Ko, and uses a lot of gradients

  • sunRise is 67 Ko, and uses a lot of gradients

  • mapWaadt is 260 Ko


If we skip those which use gradients, and the big mapWaadt image, the boost is closer to 35%. Not bad...

No comments: