Combobox performance

  • Thread starter Thread starter Fad
  • Start date Start date
F

Fad

I've measured the execution time of the following code, and it's
variable from 0,5 sec to 1 sec..
How I can improve performance..?

for (int i = 0; i < 8; i++)
{
myCombobox1[ i ].Items.Clear();
myCombobox1[ i ].Items.AddRange(stringArray1);

myCombobox2[ i ].Items.Clear();
myCombobox2[ i ].Items.AddRange(stringArray2);
}


Thanks,
Fad
 
Hello Fad,
I've measured the execution time of the following code, and it's
variable from 0,5 sec to 1 sec..

<snip>

I'm pretty sure that, given a sensible size of the arrays stringArray1 and
stringArray2, this code should not take any significant time to execute.
Of course you're leaving out the sizes of said arrays from your post,
although they surely represent the most important piece of information.

Otherwise, your source code strikes me as highly theoretical - I've never
written an application with arrays of combo boxes that were all filled
with the same content... may be me, of course.

Finally, to answer your question from a generic standpoint: you improve
application performance by analyzing the source of any perceived
performance problems using a profiler. That is a tool which can, after an
application run, give you statistics of the numbers of times a certain
piece of code has been executed, and the time spent in each or all these
runs. My personal preference for such a tool is "AQTime" by Automated QA,
but there are lots of others out there.


Oliver Sturm
 
Hi Sturm,

StringArray1 and StringArray2 have a size of 20-25 items.
I think that is a too small size for the execution time of my
application.

In my application is necessary to have multiple combobox with the same
items.. I have created array for a fast coding..

I will try AQTime.. I hope that this tool can help me..

Thanks,
Stefano

Oliver Sturm ha scritto:
 
Back
Top