May
22
2004

XML Pull Parsers Zoom!

I’ve been playing around with profiler technologies, and recently started having a look at JProfiler – attaching it my ejb running insider JBoss and then running my unit tests. The interesting thing was that I was burning a ton of time inside my XML parser (dom4j).



Some of that time I can put down to being a little too keen on XPath, but a good swag was inside parseDocument, so it’s not like I’m going to be able to tune that!



Anyways, just for kicks, I started to have a look at XPP3 – one of these “XML Pull Parser” technologies. I notice that XSteam have switched to using it – so I thought it was worth a go.



Put some metrics in my unit test for the XML->Object conversion and the stats went from 407 ms (dom4j) to 49 ms (XPP). I love dom4j’s API – but these lightweight parsers sure are zippy. For time critical portions of code, I’m going to look at turning them with XPP.



Worth a look.

About the Author: Glen Smith

Leave a comment

Glen Smith

About Glen

Co-author Grails in Action