-------- Original Message --------
Subject: Re: [xml] Simple Element+Attribute Lookup with XPath -
performance ?
Date: Fri, 18 Jul 2008 08:31:52 +0200
From: [EMAIL PROTECTED]
To: [email protected]
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Volker Grabsch wrote:
On Wed, Jul 16, 2008 at 07:40:21AM +0200, Martin Trappel wrote:
<ROOT>
<FOO Name="a">
<BAR Id="2"/>
<BAR Id="1"/>
<BAR Id="4"/>
...
<BAR Id="2345"/>
</FOO>
<FOO Name="b">
...
</FOO>
...
</ROOT>
[...]
Use the xpath search expression '[EMAIL PROTECTED]"4"]' and use the returned
nodeset.
While I don't know why this expression is slow, you might want to try
the "id()" or keyref mechanisms. They are very fast because of an
additional index structure. However, this only works properly if your
@id values are unique in the whole document, i.e. among all <FOO>
elements.
Unfortunately they are not.
You could also try to use this XPath expression:
[EMAIL PROTECTED]"4"]
It might be faster if all sub elements of <FOO> are <BAR>s.
Will have to try that, thanks!
I should have explicitly mentioned in my first mail that interestingly
the xmlXPathEvalExpression("BAR", xpc); (in example b) is
lightning-fast, but apparently given a predicate it gets really slow.
Does anyone know what extra kind of work the XPath processor needs to do
for the simple predicate [EMAIL PROTECTED]"4"] other than look it up in the
attributes of the BAR elements?
cheers,
Martin
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml