-
Enhancement
-
Resolution: Unresolved
-
P3
-
5.0
-
generic
-
generic
Recently I had a correspondence between one of the MSV users about the
way I was using Xalan's XPath API and its performance problem.
In particular, I learned that Xalan reparses the DOM tree into a DTM
before any XPath evaluation. This activity is scoped to Xalan's
XPathContext object --- IOW, if I evaluate two XPath expressions by
using the same XPathContext object, Xalan only creates a DTM once. But
if I use a fresh XPathContext, the whole DTM parsing happens again.
Previously I was using a fresh XPathContext instance for every XPath
evaluation in MSV. When I changed it to reuse XPathContext, I got a
significant performance improvement.
Now, I understand that JAXP XPath implementation is built on top of
Xalan. In fact I see code like this:
private XObject eval(String expression, Object contextItem)
throws javax.xml.transform.TransformerException {
....
if ( functionResolver != null ) {
JAXPExtensionsProvider jep = ...;
xpathSupport = new XPathContext( jep );
} else {
xpathSupport = new XPathContext();
}
....
which seems to suggest that JAXP XPath implementation has the exact same
performance issue I had in MSV earlier. I'm only looking at the code
casually, so I could very well missed something crucial.
Did whoever implemented the code have some mental model about what's
expensive? Is my concern ungrounded? Has any performance measurement
done wrt the XPath implementation?
way I was using Xalan's XPath API and its performance problem.
In particular, I learned that Xalan reparses the DOM tree into a DTM
before any XPath evaluation. This activity is scoped to Xalan's
XPathContext object --- IOW, if I evaluate two XPath expressions by
using the same XPathContext object, Xalan only creates a DTM once. But
if I use a fresh XPathContext, the whole DTM parsing happens again.
Previously I was using a fresh XPathContext instance for every XPath
evaluation in MSV. When I changed it to reuse XPathContext, I got a
significant performance improvement.
Now, I understand that JAXP XPath implementation is built on top of
Xalan. In fact I see code like this:
private XObject eval(String expression, Object contextItem)
throws javax.xml.transform.TransformerException {
....
if ( functionResolver != null ) {
JAXPExtensionsProvider jep = ...;
xpathSupport = new XPathContext( jep );
} else {
xpathSupport = new XPathContext();
}
....
which seems to suggest that JAXP XPath implementation has the exact same
performance issue I had in MSV earlier. I'm only looking at the code
casually, so I could very well missed something crucial.
Did whoever implemented the code have some mental model about what's
expensive? Is my concern ungrounded? Has any performance measurement
done wrt the XPath implementation?