Thursday, September 01, 2005

Saxon rocks! My XSLT transformations are now 20 times faster.

I'm currently developing a tailored course for one of my major clients. I use an XSLT pipleline to convert a huge Mind Map into pdf and html student notes .

As the course takes shape, the Mind Map has been getting larger and the conversion has been taking longer. Yesterday evening the publishing task ran for four and a half minutes - too slow for an agile developer like me!

Today I switched from XALAN to Saxonica's Saxon 8. The publishing task now takes 43 seconds, of which more than half is spent outside XSLT. The XSLT processing now runs 20 times faster!

I'm opening a lot of output documents in the slowest stylesheet, which may be the problem. You may not get the same speed-up in your applications. I'll do some more timings and report them here.

Saxon is developed by Michael Kay, the author of the XSLT 2.0 Programmer's reference. Michael has also played a key role in the development of the XSLT 1.0 and 2.0 specifications. Saxon comes in two versions; I'm using the free open source variety, but there is also a commercial schema aware version.

I also use the XSLT 2.0 engine/debugger in Altova's XML Spy. It's not open-source, but there is a free home edition and you can download the Altova XSLT engine separately (also free).

Saxon was the first widely available implementation of XSLT 2.0. It's functional and fast. If you're doing heavy-duty XSLT transformation, or need an open-source XSLT 2.0 engine, I strongly recommend it.

No comments: