Click here to Skip to main content
15,913,610 members
Home / Discussions / C#
   

C#

 
AnswerRe: easy newbie question Pin
shwaguy20-Sep-07 12:06
shwaguy20-Sep-07 12:06 
QuestionGridView Row updating Pin
ss.mmm20-Sep-07 9:57
ss.mmm20-Sep-07 9:57 
QuestionPerformanceCounter problems Pin
JMichael246820-Sep-07 8:53
JMichael246820-Sep-07 8:53 
AnswerRe: PerformanceCounter problems Pin
JMichael246821-Sep-07 4:36
JMichael246821-Sep-07 4:36 
QuestionSpeed up Treeview [Solved] Pin
DaveyM6920-Sep-07 8:52
professionalDaveyM6920-Sep-07 8:52 
AnswerRe: Speed up Treeview Pin
Dave Kreskowiak20-Sep-07 9:12
mveDave Kreskowiak20-Sep-07 9:12 
GeneralRe: Speed up Treeview Pin
DaveyM6920-Sep-07 10:55
professionalDaveyM6920-Sep-07 10:55 
GeneralRe: Speed up Treeview Pin
Scott Dorman20-Sep-07 10:58
professionalScott Dorman20-Sep-07 10:58 
GeneralRe: Speed up Treeview Pin
DaveyM6920-Sep-07 11:13
professionalDaveyM6920-Sep-07 11:13 
AnswerRe: Speed up Treeview [modified] Pin
Scott Dorman20-Sep-07 10:56
professionalScott Dorman20-Sep-07 10:56 
GeneralRe: Speed up Treeview Pin
Pete O'Hanlon20-Sep-07 11:19
mvePete O'Hanlon20-Sep-07 11:19 
GeneralRe: Speed up Treeview Pin
Scott Dorman20-Sep-07 11:37
professionalScott Dorman20-Sep-07 11:37 
GeneralRe: Speed up Treeview Pin
DaveyM6920-Sep-07 11:43
professionalDaveyM6920-Sep-07 11:43 
AnswerRe: Speed up Treeview Pin
DaveyM6920-Sep-07 11:31
professionalDaveyM6920-Sep-07 11:31 
GeneralRe: Speed up Treeview Pin
Scott Dorman20-Sep-07 18:26
professionalScott Dorman20-Sep-07 18:26 
GeneralRe: Speed up Treeview Pin
DaveyM6921-Sep-07 1:05
professionalDaveyM6921-Sep-07 1:05 
GeneralRe: Speed up Treeview Pin
Scott Dorman21-Sep-07 4:49
professionalScott Dorman21-Sep-07 4:49 
Hmmm...I actually just ran your sample application and your way took 409 ms while mine took 676 ms. That result bothers me for a couple of reasons:

  1. The times are very different. Granted, that is probably due to hardware differences, but I wouldn't have thought it would be that significant.
  2. The use of AddRange should still be faster.

I made one tweak to your sample, which changed the times to be within ~30 ms of each other. After several runs, it was inconclusive as to which method was consistently faster.

The change I made was in the Build(ref TreeView) function and changed the following lines:
C#
treeView.Nodes.Add(mainNode);
treeView.Nodes[0].Nodes.AddRange(childNodes.ToArray());
to
C#
mainNode.Nodes.AddRange(childNodes.ToArray());
treeView.Nodes.Add(mainNode);



Scott.

—In just two days, tomorrow will be yesterday.

[Forum Guidelines] [Articles] [Blog]

GeneralRe: Speed up Treeview Pin
Pete O'Hanlon21-Sep-07 9:12
mvePete O'Hanlon21-Sep-07 9:12 
GeneralRe: Speed up Treeview Pin
DaveyM6921-Sep-07 3:36
professionalDaveyM6921-Sep-07 3:36 
GeneralRe: Speed up Treeview Pin
Scott Dorman21-Sep-07 4:51
professionalScott Dorman21-Sep-07 4:51 
GeneralRe: Speed up Treeview Pin
DaveyM6921-Sep-07 5:50
professionalDaveyM6921-Sep-07 5:50 
GeneralRe: Speed up Treeview Pin
DaveyM6921-Sep-07 7:55
professionalDaveyM6921-Sep-07 7:55 
GeneralRe: Speed up Treeview Pin
Scott Dorman21-Sep-07 8:06
professionalScott Dorman21-Sep-07 8:06 
GeneralRe: Speed up Treeview Pin
igetorix11-May-08 5:49
igetorix11-May-08 5:49 
QuestionDataTable does not contain definition for 'Controls'???? Pin
ss.mmm20-Sep-07 8:43
ss.mmm20-Sep-07 8:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.