473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

XPathNavigator, Attribute predicate evaluation


I have implemented in .NET 2.0 a custom XPathNavigator for Xpath filtering
on an object tree. So far it works. While analyzing the performance, I have
noticed a lot of MoveToNextAttribute calls.

A closer look has shown that there seems to be a none optimal evaluation of
attribute predicates such as [@ID = '2']. It works as expected if there is a
match of the attribute value, i.e. the XPathNavigator calls
MoveToNextAttribute until it gets the ID attribute, reads the value and
finish the search.

The behaviour is different if the value if the ID attribute does not match
the value in the predicate. Then the XPathNavigator calls
MoveToNextAttribute until it returns false, i.e. until all attributes are
checked. From my point of view, the search for attributes could be stopped
if there is a match of the attribute name as the attribute names for a node
must be unique.

Stop the search if the attrbute name matches would improve the performance
by factors. In my data model, there are about 20 attributes. Most the
filters are using the ID attribute. By placing the ID attribute at the first
position in the collection, the potential performance gain is a factor of
20.


Mar 3 '06 #1
1 1808

I'm nobody of authority, but I'd say you have an excellent point there!

Since you've implemented a navigator in 2.0, do you find that there is
anything that would need to be done differently than one in 1.1? I have done
a couple in 1.1, and since I'm just getting familiar with 2.0 proper I really
don't know all of the ways in which I could improve my performance with it..
I have read that the xmlnametable implementation is better, but that's all I
have so far...

Any tips?

"SteZgr" wrote:

I have implemented in .NET 2.0 a custom XPathNavigator for Xpath filtering
on an object tree. So far it works. While analyzing the performance, I have
noticed a lot of MoveToNextAttribute calls.

A closer look has shown that there seems to be a none optimal evaluation of
attribute predicates such as [@ID = '2']. It works as expected if there is a
match of the attribute value, i.e. the XPathNavigator calls
MoveToNextAttribute until it gets the ID attribute, reads the value and
finish the search.

The behaviour is different if the value if the ID attribute does not match
the value in the predicate. Then the XPathNavigator calls
MoveToNextAttribute until it returns false, i.e. until all attributes are
checked. From my point of view, the search for attributes could be stopped
if there is a match of the attribute name as the attribute names for a node
must be unique.

Stop the search if the attrbute name matches would improve the performance
by factors. In my data model, there are about 20 attributes. Most the
filters are using the ID attribute. By placing the ID attribute at the first
position in the collection, the potential performance gain is a factor of
20.


Apr 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jacques | last post by:
Is it possible to predicate by attribute, and if so, how? <System xmlns="" name="SAP_R3_Financials_DEV200"> <Attributes xmlns=""> <pcd:Attribute name="ApplicationServer" value="secacsap"/>...
7
by: news.microsoft.com | last post by:
Hi, Is the compilation of XSLT, using XPathNavigator.Compile, only beneficial when the returned XPathExpression is cached? Next question, how do I cache the returned XPathExpression object? ...
0
by: bughunter | last post by:
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....
4
by: Karine Bosch | last post by:
Hi, My xml document uses different namespaces: <x:root xmlns:x="x:ns:meta/"> <element1 xmlns:adam="http://ns.alfaprint.be/"> </root> This gives problems when using an XPath query. I...
1
by: Keith Patrick | last post by:
I'm converting over from using XmlNodes (specifically ConfigXmlNode, but the API uses XmlNode) to IXPathNavigable in some methods I have, but I'm finding in the process, that I can't seem to get...
0
by: kelvin273 | last post by:
Hi all, i'm new in this community (and in .NET programming) and i've a problem with xpathnavigator. The idea is to have an xml document with attribute editable by windows form. I write this...
2
by: =?Utf-8?B?Tm9yZW1hYw==?= | last post by:
Hi. Using VS2005, .NET 2.0. I have an xml document that I want to go through and set the values on attributes of elements. The elements are complex types defined in my schema (xsd) files. ...
3
by: Arun Srinivasan | last post by:
I have a query that has 5 predicates, scanning a table of 400+ million rows and I have built indexes getting help from design advisor and other tools. The cost of that query is really low. But I...
2
by: =?Utf-8?B?QXJuZQ==?= | last post by:
I use XpathNavigator ut process the XML data I get from a web service. I know how to select a specific node. How Do I pick of the attribute of a node?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.