What's cached in the CachedXPathAPI is the source document model. Building
that is generally the most expensive part of evaluating an XPath, so if
you're going to run multiple XPaths against the same document you should
definitely consider using CachedXPathAPI rather than XPathAPI. (On the
other hand, caching has some obvious issues if you want to alter the source
document. See the javadoc.)

"Compiling" a single XPath really doesn't take very long.

We might be able to improve performance by compiling XPaths down to
bytecodes, as we do for complete stylesheets in XSLTC -- "pathlets", to
correspond with XSLTC's "translets". I don't think we currently support
that mode of operation, but it definitely seems worth investigating.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk

Reply via email to