Improving XSLT performance with Woodstox/SAX (or Aalto): 20-30% more thorughput!
One thing I mentioned earlier regarding potential use cases for Woodstox' SAX API implementation was to speed up XSLT processing. 2 main Java XSLT processor contestants -- Xalan and Saxon -- both use SAX as their primary input source. Since Woodstox is a tad faster for both reading and writing XML than its leading open source competitors (including one JDK bundles, Xerces), one would expect some speed boost for using Woodstox as the SAX parser.
To test out this hypothesis, I wrote some more StaxBind code (which
currently lives within Woodstox svn repository at Codehaus) to allow
running set of XSLT stylesheets over documents: in this case test cases
of XSLTMark test suite.
For
additonal fun, I also included tests using Aalto
given it also implements SAX and is complete enough to handle XSLT
transformations just fine. For the first test run, I chose Saxon; I will
later do the same with Xalan.
So here's a quick look at combined results over couple dozen tests:
Or, check out complete results for full overview.
The executive summary is that using Woodstox can give you 20-30% more throughput for these test cases; and consistently at least some speed up. Aalto can give another slight boost as well. And given how simple it all is (see here for a reminder), it should be a nice easy win.
What next? Well, in addition to testing Xalan, it would also be nice to get a more representative set of real-world stylesheets. But for now, I'll assume these results are representative.