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
This commit is contained in:
Daniel Veillard 2001-04-28 14:35:02 +00:00
parent 2156a56bcb
commit e39a93d0d3
3 changed files with 33 additions and 18 deletions

View File

@ -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

6
TODO
View File

@ -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 @@ TODO:
- 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

39
xpath.c
View File

@ -252,6 +252,7 @@ struct _xmlXPathStepOp {
int value3;
void *value4;
void *value5;
void *cache;
};
struct _xmlXPathCompExpr {
@ -373,6 +374,7 @@ xmlXPathCompExprAdd(xmlXPathCompExprPtr comp, int ch1, int ch2,
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 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) {
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;