I have a program with two forms. The first form has an infragistics toolbar, button, and a couple ultragrids bound to two binding sources and display after my splash screen is closed.
The second form has 7 ultracombo controls, 4 ultradatetimeeditor controls, ultra tab control, 4 textboxes, 3 ultramaskededit controls, 1 ultranumeric editor,ultraspellchecker, and they are all bound to a bindingsource of List<myobject>.
There is a delay on the first form opening, but it is not all that noticeable due to the splash screen. However, the delay on the second screen is very noticeable to the user (about 1 second delay). Enough that it seems like you haven't clicked the button. The second time this form loads, it comes up quickly.
Things I have tried to fix it:
-went through the posts here on performance for wingrids, etc. Set celldisplaystyle to plain text on combo controls. removed auto resizing from ultra combo columns (this helps a lot).
-preload all the infragistics assemblies I am using in my splash screen using System.Reflection.Assembly.Load()
-ran ngen on my app and dependencies (did not seem to make a difference, maybe because of previous item in this list).
-ran a profiler on it. seemed like all the time was spread out over all the controls in InitializeComponent.
-removed all the controls one by one on the form. There was no particular one that was a smoking gun, but if I removed all the editor controls and just left the ultrapanels it got fast again.
Also, I noticed this line the first time the form opened but not after:
Loaded 'C:\Windows\assembly\GAC_MSIL\Infragistics.License\1.0.5005.10__7dd5c3163f2cd0cb\Infragistics.License.dll'
Anyways, I'm stumped. Maybe the ultra combo control is just too 'heavy' to have this many on a page?
It's hard to say with limited information. And if your profiler shows no particular hotspots, then it seems like you might just be putting too much into one form.
jeffkov said:-ran a profiler on it. seemed like all the time was spread out over all the controls in InitializeComponent.
Before you mentioned the profiling, my best guess here would have been that the UltraCombo might be causing the problem.By default, UltraCombo searches it's list using a Binary search. This requires it to build a sorted list of values when it is populated the first time or whenever the list changes. This can cause a slight delay in loading the control initially, but gives you a big gain in performance later on when the user is typing into the combo or any time it has to search the list.
But if that were the problem, it would certainly show up on the profile.
How many rows do your UltraCombo controls have?
Sorry, should have mentioned.. I had previously turned off binary search, it sped up the startup speed quite a bit.
They all have maybe a dozen or two entries except for one combo that has 1000.
It just seems strange that it's only slow the first time the form loads but not after.I'll play around with loading some of the controls on my splash screen.
I tested the following cases (bear in mind my system is a lot faster than the client systems).
Time to load the form:
484ms - regular load time151ms - second load time651ms - after form preloaded unbound, minimized, not shown on taskbar287ms - after form preloaded unbound, NOT minimized.635ms - after another form with same controls preloaded, not minimized.So the only way to get it loading faster was actually having the form flicker up on the screen briefly.I imagine if I had it databound to something it would drop back to the 151ms. Almost seems like it's JIT'ing but when I ran Ngen on the .exe and controls I didn't see a difference.
Thanks jeffkov,
i'll try.
I run ngen.exe from .net framework directory on all the assemblies on the first run after install. If you have it queue the ngen (which you probably should if it isn't part of your install process) you won't see the speedup the first time you run it.
Make sure you run the ngen.exe from the framework64 directory if you are on a 64 bit machine.
I found it also sped it up a litte bit more to bring up a copy of your window behind your splash screen and then close it while loading, not sure why.
You could also look at preloading assemblies with System.Reflection.Assembly.Load()
Hello,
me too have the same problem. Its slow the first time i load a form.
How did you solve?
thank you.
Thanks for the comment.. I went back and double checked.. I was running the 32 bit version of NGen and the app was running in 64bits so it was having no effect. I ran the 64 bit version of NGen on the app and form opening time dropped down to 300ms. If I preload the form under the splash screen and NGen it dropped to 170ms. So NGen'ing definitely made it faster but there it something else going on as well. Anyways, it's fast enough now. I think I'll leave the popunder form in as well since not all users will have the admin rights necessary to run NGen and clickonce seems to have no provision for automatically elevating it.
Thanks Mike!
The fact that it's so much faster the second time you load the same form is a strong indication that the problem is the JITing of the assemblies. But you are right, if that's the case, using NGen to pre-JIT the asemblies should fix that.