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

Konrad Lanz <[email protected]>
Newsgroups gmane.text.xml.xalan.java.user
Message-ID <[email protected]>
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
Konrad_Lanz.vcf (text/x-vcard, 381 B)
begin:vcard
fn:Konrad Lanz
n:Lanz;Konrad
org:IAIK/SIC;Java Security
adr:http://jce.iaik.tugraz.at/sic/products/xml_security/;;Inffeldgasse 16a;Graz;Styria;8010;Austria
email;internet:[email protected]
title:DI, Bakk.techn., BSc Hons
tel;work:+43 316 873 5547
x-mozilla-html:FALSE
url:http://www.iaik.tugraz.at/content/about_iaik/people/lanz_konrad/
version:2.1
end:vcard
smime.p7s (application/x-pkcs7-signature, 7.9 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.