Re: [xml] Simple Element+Attribute Lookup with XPath - performance ?
- From: Martin Trappel <0xCDCDCDCD gmx at>
- To: xml gnome org
- Subject: Re: [xml] Simple Element+Attribute Lookup with XPath - performance ?
- Date: Sun, 20 Jul 2008 16:10:55 +0200
-------- Original Message --------
Subject: Re: [xml] Simple Element+Attribute Lookup with XPath -
Date: Fri, 18 Jul 2008 08:31:52 +0200
From: 0xCDCDCDCD gmx at
To: xml gnome org
References: <487D89C5 80306 gmx at> <20080717083257 GA16927 flap>
Volker Grabsch wrote:
On Wed, Jul 16, 2008 at 07:40:21AM +0200, Martin Trappel wrote:
Use the xpath search expression 'BAR[ id="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>
Unfortunately they are not.
You could also try to use this XPath expression:
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 [ id="4"] other than look it up in the
attributes of the BAR elements?
] [Thread Prev