This is more an observation than a request for assistance. I understand
that the descendent-or-self axis (//) can be an inefficient way of
writing a query if a more specific query is possible. However, there is
one particular type of expression using '//' that XPathNavigator
executes far slower than I would expect, these are queries of the form:
/a[predicate]//b
If I drop the predicate then the query executes quickly, as does //b
all by itself. I would expect the more refined location prior to the
'b' element to refine the search and therefore result in faster
execution, but in fact it causes a dramatic slow down.
If I perform a similar opertaion in code by executing:
/a[predicate]
then loop through the resulting nodeset, calling SelectNode("//b") on
each node, then this also executes quickly.
It would be interesting to know if this is an inherent quality of this
type of XPath query, or whether it is a shortcoming in XPathNavigator's
execution logic.