Click to See Complete Forum and Search --> : performance problem


martinhoge
October 24th, 2005, 08:59 AM
Hi,

I've got some performance problems in my application, only with design
part on control side, so there are no db connections and such things, just pure design.

On my Form, there are many controls in it. For dividing them along splitters, most of them are placed in another controls - finally it is a big tree.
Totaly there is about 20-25 controls (mean class somehow derived from Control class) on form. When application is starting, it takes lot of time to show them, and even, all of them are showed in weird order, they appear gradually, it is bad. I would like them to show at one moment.

Another problem I see in using sliders. Main form is divided into two parts by vertical splitter. On both sides, there are few ( about 3) horizontal splitterrs. If I move main vertical splitter, it takes about 1-2 seconds for everything to appear in appropriate orded. All controls are again resized gradually, that's not good effect.

Most of controls initializing I am doing at constructors, I don't use OnLoad stuff.

Have you got some advices how to make it faster ?? If you know some article about it for instance, please write me as well.

Thanks

Martin

darwen
October 24th, 2005, 10:22 AM
Firstly, do you have the double buffering enabled for your controls ?

Secondly, are you doing anything in the OnSizeChanged or handling the SizeChanged event for any of your controls ?

Thirdly, what spec of PC are you using, and what memory does it have ?

Darwen.

martinhoge
October 25th, 2005, 10:48 AM
Hi,
no, I havent double buffering for controls, only two need it, so I just removed OnPaintBackground from them. I'm working on 2 Ghz, 500mb ram.

There was and still is problem with resizing as you wrote. I take DevPartner for help, it showed me many calls of OnResize functions. Alll my controls are derived from SFControl, what is control what supports themes and printing etc.. . I have made OnResize override into this control, to show me, how many times it is called. It was about 300 times, wow. Something was bad there.

I have done some research about it, OnResize is for instance called every time, when control is docked somewhere and another control is added into parent control. Well, I forget SuspendLayout and ResumeLayout. I've put theme everywhere I forgot it to do and I got rid of many OnResizeCalls.
Now, SFControl::OnResize.. is called about 150 times, I must work on on it.
It is faster now, but not enought.

I've made all forms on main form invisible and after everything is loaded
I set it on visible=true, however, controls are still appearing gradually, faster, but I see that difference.