Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Canonicalizer Performance

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
  • To: Michael Kay <mike AT saxonica.com>
  • Cc: 'xom-interest' <xom-interest AT lists.ibiblio.org>, 'Elliotte Harold' <elharo AT metalab.unc.edu>
  • Subject: Re: [XOM-interest] Canonicalizer Performance
  • Date: Mon, 28 Aug 2006 11:42:04 -0700


On Aug 28, 2006, at 11:13 AM, Michael Kay wrote:

I have profiled, and it is hanging in the XPath Query

write(node.query(".//. | .//@* | .//namespace::*"));

If you have 30,000 elements in your document, and each has an average of
1000 namespace prefixes in scope, then there will be 30,000,000 namespace
nodes in the document, so whatever technology you use, this query is going
to be seriously slow.

Even if it's not as bad as that, however, most XML software is likely to be
optimized for the case where the number of namespace bindings in a document
doesn't exceed a dozen or so. That's certainly the case with Saxon, for
example lookup of namespace prefixes always uses a serial search.

Whoever designed this was wantonly careless about the practical
implications.

Michael Kay
http://www.saxonica.com/

I don't know the document in question, but the statement below doesn't seem to necessarily imply each element having 1000 namespace prefixes in scope.

There's something very unusual about your test case document. It has
over 3000 different namespace prefixes, many of which seem to point to
the same three or so namespaces.


Rather, the namespaces might be *partitioned* over the document. Something like this

<root>
<elem xmlns:ns1="http://foo";>...</elem?
<elem xmlns:ns2="http://foo";>...</elem?
...
<elem xmlns:ns3="http://foo";>...</elem?
</root>

I've occasionally seen such output from some SOAP serializers. Admittedly not the kind of input one might hope for, but at the same time, not something that should cause dramatic degradation or failure.

Wolfgang.





Archive powered by MHonArc 2.6.24.

Top of Page