You can enlighten yourself. Spend a few minutes and write your own test that
does the same thing both ways and simply time it. Then repeat it x number of
times (where x is really big). I just did as much and the XmlDataDocument
beat the DataSet speed-wise. Granted, I had to remember how to write the
stupid XPath query so the XmlDataDocument took me way longer to write :)
static void Main(string[] args)
{
int count = 1000;
StartCount();
for(int i = 0; i < count; i++)
{
DataSet data = GetDataSet();
DataRow[] rows = data.Tables[0].Select("bMulticast=false");
}
EndCount("DataTable.Select took\r\n{0}");
StartCount();
for(int i = 0; i < count; i++)
{
DataSet data = GetDataSet();
XmlDataDocument doc = new XmlDataDocument(data);
XmlNodeList list = doc.SelectNodes("//Table[bMulticast[.='false']]");
}
EndCount("XmlDataDocument.SelectNodes took\r\n{0}");
Console.ReadLine();
}
static DateTime start;
static void StartCount()
{
start = DateTime.Now;
}
static void EndCount(string format)
{
DateTime end = DateTime.Now;
TimeSpan diff = end - start;
Console.WriteLine(format, diff);
}
static DataSet GetDataSet()
{
//build and return a dataset
}
> -----Original Message-----
> From: Torsten Kramer [mailto:[EMAIL PROTECTED]
> Sent: Freitag, 6. Juni 2003 15:16
> To: [EMAIL PROTECTED]
>
> Hi,
>
> I've one of these very pretty DataSet instances. But I don't
> want to use SQLs select syntax to query my DataSet, I want to
> use XPath. Therefore I attach my DataSet to an XmlDocument
> and use SelectSingleNode or even the methods of
> IXPathNavigator. But what does this cost with respect to
> performance and memory consumption? What is faster -
> DataTable.Select or XmlDocument.SelectNode/SelectSingleNode?
>
> Who can enlighten me?