Re: [xml] on improving xmlSearchNs
- From: Daniel Veillard <veillard redhat com>
- To: Luca Padovani <lpadovan cs unibo it>
- Cc: "xml gnome org" <xml gnome org>
- Subject: Re: [xml] on improving xmlSearchNs
- Date: Thu, 11 Sep 2003 18:01:16 -0400
On Thu, Sep 11, 2003 at 08:35:07PM +0200, Luca Padovani wrote:
Hi Daniel,
while profiling libxslt we experimented a bit with a variant of
xmlSearchNs (libxml2/tree.c), but we're not sure if the code is
"semantically" correct. What about adding the following lines
cur = node->ns;
if (cur != NULL) {
if (cur->prefix == NULL && nameSpace == NULL &&
cur->href != NULL)
return cur;
if (cur->prefix != NULL && nameSpace != NULL &&
cur->href != NULL &&
xmlStrEqual(cur->prefix, nameSpace))
return cur;
}
right after the while loop that looks for the namespace in the
node->nsDef field? In fact it is very likely for two nodes in the same
document to share the same namespace, especially if they're closely
related (like child-parent).
With that code in place we noticed a dramatic improvement in libxslt
without problems in the generation of the document, but it might be just
a fortunate fact.
That should work becuse if the node uses it then the namespace binding
should be active on that node and hence the search could be shortcut if
it matches. But please provide a small contextual patch so I sure I don't
confuse it. Something similar could be used for xmlSearchNsByHref I
think.
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]