PC Review


Reply
Thread Tools Rate Thread

DataTable Performance

 
 
Brian Gideon
Guest
Posts: n/a
 
      11th Jul 2007
I'm interested in knowing the runtime complexity of the DataTable.Find
method in 2.0 when attempting to find a row by the primary key. The
MSDN documentation is vague...probably intentionally. I used .NET
Reflector to examine the DataTable and what I found is that the
primary key index is implemented with a red black tree. That leads to
be believe that the operation is O(log n) unless something else was
going on that I missed. I'm a little disappointed that a O(1)
algorithm isn't used, but I can understand the reasoning behind the
BST since it keeps the index in a sorted order. Can anyone else
confirm?

 
Reply With Quote
 
 
 
 
Brian Gideon
Guest
Posts: n/a
 
      11th Jul 2007
On Jul 11, 9:55 am, Brian Gideon <briangid...@yahoo.com> wrote:
> I'm interested in knowing the runtime complexity of the DataTable.Find
> method in 2.0 when attempting to find a row by the primary key. The
> MSDN documentation is vague...probably intentionally. I used .NET
> Reflector to examine the DataTable and what I found is that the
> primary key index is implemented with a red black tree. That leads to
> be believe that the operation is O(log n) unless something else was
> going on that I missed. I'm a little disappointed that a O(1)
> algorithm isn't used, but I can understand the reasoning behind the
> BST since it keeps the index in a sorted order. Can anyone else
> confirm?


As a follow up I presume calling
DataTable.DefaultView.ApplyDefaultSort = true is O(1) since the
primary key is already sorted?

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataTable performance Jameson Microsoft C# .NET 1 21st Jan 2009 09:42 AM
DataTable Performance Brian Gideon Microsoft Dot NET 1 11th Jul 2007 04:10 PM
DataTable search performance Larry Smith Microsoft C# .NET 2 3rd Jan 2007 07:30 PM
DataTable performance pinhead Microsoft ADO .NET 4 3rd Apr 2006 02:52 PM
performance on updating a DataTable john Microsoft ADO .NET 1 9th Sep 2003 10:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:19 PM.