views:

60

answers:

2

We have a medium sized application that depends on several usercontrols, namely:

A tablelayout panel, with 2x5 grid of usercontrols, with 3+ levels of inheritance. A big issue we're running into with our application has proven to be startup time (both cold\warm), one of the big big hangups we're getting is initializing this usercontrol grid.

From our timing reports, this form comes in at about 0.75 seconds for initialization, and cutting this down would be a big deal.

My question is: What the heck can I do to speed this up? Whenever I run timing checks on similar-complexity InitializeComponents (all windows, .net controls), the result is magnitudes less (<10 milleseconds) sometimes.

edit) I'm wondering if things like marking my final classes sealed or something similar would help.

edit2) I've looked deeper into the timing of initializecomponent, and for my current machine, The main container adds 10 components to it (at 10ms a piece). Each of those components adds 3 components (at 10ms a piece). 10x10 + 30x10 = 700ms. Unless I can increase the speed at which items get added to their containers, I think I'm SOL.

+1  A: 

Are you doing anything that relies on external factors in the controls initiation, such as accessing the network, or pulling from a database? These can increase the load time of your application.

Check for any loops as well and try and reduce these.

Aequitarum Custos
No, these are all strictly standard System.Windows.Forms components, no database calls.
greggorob64
A: 

It may or may not be related, but I had a similar problem using the TableLayoutPanel. The problem was the drawing time, as revealed by a profiler. The combination that was causing problems for us was transparency on the inner controls and dynamic resizing. I played with some of the CreateParams options, but unfortunately, I ended up having to create a custom layout engine to make it really sing.

In any case, I would definately download a free trial version of a profiler right now. The performance problem is often in an unexpected location. You can spend hours optimizing somewhere you think is the culprit, only to gain 0.0001ms in performance difference.

Dave
I recommened EQATec Profiler, has a free version, and to me was easier to use than RedGate's solutions: http://www.eqatec.com/tools/profiler
Aequitarum Custos
Alas, I am in the world of Visual C++, the scourge of the profiler world. There is only 1 profiler I've gotten that allows mixed-mode, and it didn't give adequate results (cannot remember the name).
greggorob64