This improves seriously some XSLt speed tests:
- xpath.c: simple and efficient optimization, XPath functions
aways bind to the same code, cache this
- TODO: updated (by saying some is obsolete)
Daniel
diff --git a/ChangeLog b/ChangeLog
index 8f470cc..62e3442 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat Apr 28 16:33:05 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+ * xpath.c: simple and efficient optimization, XPath functions
+ aways bind to the same code, cache this
+ * TODO: updated (by saying some is obsolete)
+
Sat Apr 28 14:23:30 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* xpath.c: more cleanup work on XPath name parsing routines
diff --git a/TODO b/TODO
index 343d2f4..2225635 100644
--- a/TODO
+++ b/TODO
@@ -2,14 +2,15 @@
TODO for the XML parser and stuff:
==================================
+ $Id$
+
+ this tend to be outdated :-\ ...
TODO:
=====
- Computation of base when HTTP redirect occurs, might affect HTTP
interfaces.
-- performances: there is still improvements needed when parsing Docbook DTD
- a single function to optimize/avoid.
- DOM needs
int xmlPruneProp(xmlNodePtr node, xmlAtttrPtr attr);
- listing all attributes in a node.
@@ -18,6 +19,7 @@
- Better checking of external parsed entities TAG 1234
- Find way of representing PERefs in the Dtd so that %entity; can
be saved back.
+ => seems impossible in a structure way
- Go through erratas and do the cleanup.
http://www.w3.org/XML/xml-19980210-errata ... started ...
- Handle undefined namespaces in entity contents better ... at least
diff --git a/xpath.c b/xpath.c
index a579ff0..2391063 100644
--- a/xpath.c
+++ b/xpath.c
@@ -252,6 +252,7 @@
int value3;
void *value4;
void *value5;
+ void *cache;
};
struct _xmlXPathCompExpr {
@@ -373,6 +374,7 @@
comp->steps[comp->nbStep].value3 = value3;
comp->steps[comp->nbStep].value4 = value4;
comp->steps[comp->nbStep].value5 = value5;
+ comp->steps[comp->nbStep].cache = NULL;
return(comp->nbStep++);
}
@@ -7229,26 +7231,31 @@
if (op->ch1 != -1)
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- if (op->value5 == NULL)
- func = xmlXPathFunctionLookup(ctxt->context, op->value4);
+ if (op->cache != NULL)
+ func = (xmlXPathFunction) op->cache;
else {
- const xmlChar *URI;
- URI = xmlXPathNsLookup(ctxt->context, op->value5);
- if (URI == NULL) {
+ if (op->value5 == NULL)
+ func = xmlXPathFunctionLookup(ctxt->context, op->value4);
+ else {
+ const xmlChar *URI;
+ URI = xmlXPathNsLookup(ctxt->context, op->value5);
+ if (URI == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathRunEval: function %s bound to undefined prefix %s\n",
+ op->value4, op->value5);
+ return;
+ }
+ func = xmlXPathFunctionLookupNS(ctxt->context,
+ op->value4, URI);
+ }
+ if (func == NULL) {
xmlGenericError(xmlGenericErrorContext,
- "xmlXPathRunEval: function %s bound to undefined prefix %s\n",
- op->value4, op->value5);
+ "xmlXPathRunEval: function %s not found\n",
+ op->value4);
+ XP_ERROR(XPATH_UNKNOWN_FUNC_ERROR);
return;
}
- func = xmlXPathFunctionLookupNS(ctxt->context,
- op->value4, URI);
- }
- if (func == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathRunEval: function %s not found\n",
- op->value4);
- XP_ERROR(XPATH_UNKNOWN_FUNC_ERROR);
- return;
+ op->cache = (void *) func;
}
func(ctxt, op->value);
return;