[xml] on improving xmlSearchNs



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.

-- Luca




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