UI optimization (.net framework seems slow)
-
Hi! I've noticed that my app is a bit slow-starter because i have hundreds of controls. I did a little test: I created a form with a couple of buttons and a TabControl with 6 tabpages. I ran the application and moved the form on top of another window (browser), and the cpu time for that browser window reached 50% !!!I don't know what´s causing the cpu burst...it's just a form with 2 buttons and a tabControl, i don't have any other code!!! Can anybody tell me performance tips for UI optimization when the application is loading, because when the application is loading it takes to long to draw all the controls and then resizing them!!! And what about at compilation time? Is there some options to enable (or disable) in order to make the app quicker?Another thing is the jit debugger. Doesn't it slow down the application?How to turn it off? Never say never
-
Hi! I've noticed that my app is a bit slow-starter because i have hundreds of controls. I did a little test: I created a form with a couple of buttons and a TabControl with 6 tabpages. I ran the application and moved the form on top of another window (browser), and the cpu time for that browser window reached 50% !!!I don't know what´s causing the cpu burst...it's just a form with 2 buttons and a tabControl, i don't have any other code!!! Can anybody tell me performance tips for UI optimization when the application is loading, because when the application is loading it takes to long to draw all the controls and then resizing them!!! And what about at compilation time? Is there some options to enable (or disable) in order to make the app quicker?Another thing is the jit debugger. Doesn't it slow down the application?How to turn it off? Never say never
<soapbox>Hundreds of controls on one form? Yuk! No, seriously, from a users standpoint, Yuk! Talk about information overload.</soapbox> carlos_rocha wrote: Can anybody tell me performance tips for UI optimization when the application is loading, because when the application is loading it takes to long to draw all the controls and then resizing them!!! Let me guess... You stuck all these controls on various tab pages, layed everything out nice and neat and then setup every controls anchoring so that the resize and reposition themselves as needed. Am I correct? Here's a hint on what you did. Let's say you have 600 controls on 10 tab pages. That's 60 controls per page. Now, when the user sits in front of your application, he/she only sees the first 60 controls and can only interact with those 60. But, whenever the form is resized, the layout engine has to call the resize event handler for all 600 controls, not 60. So, your forcing A LOT of calculation you don't want to do because you can't see those controls. What to do...? What to do...? Unfortunately, the only optimization technique is to break that massive form down into smaller forms and skip using tab pages. Search for ways to get the number of controls down. For example, if there are 3 out of those 10 tab pages that deal with a specifc subject matter, break those pages into their own form. You're simply not going to get the performance you want because of the thousands of calculations you generated to figure out the new positions and sizes of controls you can't even see. So why reposition them? carlos_rocha wrote: And what about at compilation time? Is there some options to enable (or disable) in order to make the app quicker? In a Release version compile, the optimations are already turned on. carlos_rocha wrote: Another thing is the jit debugger. Doesn't it slow down the application?How to turn it off? You can't! When you launch the application, the Just-In-Time compiler turns your Intermmediate Language code (which won't run on a single processor in the world!) and turns it into machine specific code that the processor can run. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
<soapbox>Hundreds of controls on one form? Yuk! No, seriously, from a users standpoint, Yuk! Talk about information overload.</soapbox> carlos_rocha wrote: Can anybody tell me performance tips for UI optimization when the application is loading, because when the application is loading it takes to long to draw all the controls and then resizing them!!! Let me guess... You stuck all these controls on various tab pages, layed everything out nice and neat and then setup every controls anchoring so that the resize and reposition themselves as needed. Am I correct? Here's a hint on what you did. Let's say you have 600 controls on 10 tab pages. That's 60 controls per page. Now, when the user sits in front of your application, he/she only sees the first 60 controls and can only interact with those 60. But, whenever the form is resized, the layout engine has to call the resize event handler for all 600 controls, not 60. So, your forcing A LOT of calculation you don't want to do because you can't see those controls. What to do...? What to do...? Unfortunately, the only optimization technique is to break that massive form down into smaller forms and skip using tab pages. Search for ways to get the number of controls down. For example, if there are 3 out of those 10 tab pages that deal with a specifc subject matter, break those pages into their own form. You're simply not going to get the performance you want because of the thousands of calculations you generated to figure out the new positions and sizes of controls you can't even see. So why reposition them? carlos_rocha wrote: And what about at compilation time? Is there some options to enable (or disable) in order to make the app quicker? In a Release version compile, the optimations are already turned on. carlos_rocha wrote: Another thing is the jit debugger. Doesn't it slow down the application?How to turn it off? You can't! When you launch the application, the Just-In-Time compiler turns your Intermmediate Language code (which won't run on a single processor in the world!) and turns it into machine specific code that the processor can run. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Hi! You were close! I have a sort of treeView that has 3 levels where the third level is a panel(question) constitued by 5 controls.It's a tree of questions.I can have up to 40 questions, and several of these trees.So basically i´m f*#$d :D You suggested turning the lowest level in a little form? I'll try it. I don't know what's the correct wat to design applications which has a lot of controls. What about ngen.exe does it turn the application quicker? Never say never
-
Hi! You were close! I have a sort of treeView that has 3 levels where the third level is a panel(question) constitued by 5 controls.It's a tree of questions.I can have up to 40 questions, and several of these trees.So basically i´m f*#$d :D You suggested turning the lowest level in a little form? I'll try it. I don't know what's the correct wat to design applications which has a lot of controls. What about ngen.exe does it turn the application quicker? Never say never
NGen compiles your application into processor native code. It doesn't speed up your application at all. The JIT compiler is extremely fast and only adds a very small amount of time to your applications startup time. It does this by only compiling the code that is needed at that time. If you have 100 forms in your application, it only compiles the one that it needs to start. The remaining forms don't get compiled until they are called. On top of that, once the code is compiled it stays that way for the duration of the applications session. That means the JIT doesn't have to compile the same code over and over again for each use. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome