[xslt] Streaming XPath compilation in xsltXPathCompile()



Hi,

xsltXPathCompile() in xsltutils.c could be further optimized,
as it currently won't use the optimized streaming XPath
for simple expressions if the expression contains prefixed
name tests, due to the fact that xmlPatterncompile needs
a list of in-scope namespace for prefixed name tests.
So we get the time-penalty for trying to stream-compile the
expression but we don't get the efficiency for its execution.

xsltXPathCompile() is used in attrvt.c and keys.c.

Call-stack:
xsltXPathCompile (xsltutils.c)
--> xmlXPathCtxtCompile (Libxsml2, xpath.c)
--> xmlXPathTryStreamCompile (Libxml2, xpath.c)
--> xmlPatterncompile (Libxml2, pattern.c)
--> xmlCompileStepPattern (Libxml2, pattern.c)
where we hit the following:
if (i >= ctxt->nb_namespaces) {
	ERROR5(NULL, NULL, NULL,
		"xmlCompileStepPattern : no namespace bound to prefix
%s\n",

A way to fix this would be to feed the xmlXPathContext with
the current in-scope namespaces. *But*, on the other side,
this will generate a copy of all the given in-scope namespaces
in xmlXPathTryStreamCompile(); I'm not sure if we want a copy
of such a list for every compiled expression. So I really don't know
would be the optimal solution here.

If there was a chance of adjusting xmlXPathTryStreamCompile() to *not*
to copy the list (maybe per context option), then this would be the
ideal solution, I think.

Regards,

Kasimier



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]