You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Konrad Lanz <Ko...@iaik.tugraz.at> on 2009/05/15 14:10:11 UTC

Performance Problem / javax.xml.xpath vs. org.apache.xpath

Hi Xalan Developers,

when using the javax.xml.xpath API there seems to be a big performance
hit compared to using the org.apache.xpath API.

When evaluating a compiled XPath expression multiple times on different
context nodes as specified in Xpath Filtering
http://www.w3.org/TR/xmldsig-core/#sec-XPath it seems to take about 30
times longer.


> e.g.:
> private XPathExpression compiledXPathExpr_;
> ...
> return ((Boolean) compiledXPathExpr_.evaluate(contextNode,
> XPathConstants.BOOLEAN)).booleanValue();


As a potential source for the performance hit we identified the Method
"private XObject eval ( Object contextItem )" in
"org.apache.xpath.jaxp.XPathExpressionImpl.eval()" .

It performs much worse compared to the following code ...

> e.g.:
> private XPath xpath_;
> ...
> XObject xobject = xpath_.execute(context_, contextNode,
>   prefixResolver_);
> boolean result = xobject.bool(); 
> return result;


We beleieve the time is lost on XPathContext creation.

Thanks in advance and best regards

Konrad Lanz


-- 
Konrad Lanz, IAIK/SIC - Graz University of Technology
Inffeldgasse 16a, 8010 Graz, Austria
Tel: +43 316 873 5547
Fax: +43 316 873 5520
http://www.iaik.tugraz.at/content/about_iaik/people/lanz_konrad/
http://jce.iaik.tugraz.at/sic/products/xml_security/

Downlaod certificate chain (including the EuroPKI root certificate):
http://ca.iaik.tugraz.at/capso/certs.jsp