Hi,
my problem is that I have a smal dialog whith some UltraLabel in a TabelLayoutPanel.
I want to set the UltraLabel to AutoSize = true but this resolves in a bad performance.
I added a Demo Version.
I this you have 3 Versions of my Dialog
1 whith UltraLabel.AutoSize = true and DockStyle= Fill
1 whith UltraLabel.AutoSize = false and DockStyle= Fill
1 whith UltraLabel.AutoSize = true and DockStyle= None
all the other things are the same (I only copyed the Dialog)
On the start Form you can open all this Dialogs and the Dialog (AutoSize = true and DockStyle= Fill) from a member so you see the constructor dose not cost much time.
If you try it you can see UltraLabel.AutoSize = false and DockStyle= Fill is much more performant than the other.
Any idea why this is so or a way to get AutoSize whithout losing performace?
Thanks
Wolfgang
Hi Wolfgang,
There's a very similar issue reported here: UltraLabel performance - Infragistics Community
It's not exactly the same situation you are in, but I beleive it's probably the same basic underlying issue and the workaround I posted there may help you, as well.
Hi Mike,
i have tested it and it brings me no performance. I added in the constructor after the InitializeComponent() Method call the CreateControl Method on all Label this brings no performance.
Or must I remove the Label from the desigenerfile and add them on runtime (this woud take away the power of the designer).
After the call to InitializeComponent in the form's constructor should work. You might want to try it in Form_Load just to be sure, but it sounds like the issue you are experiencing is different than the other one for which I posted that workaround.
I ran the sample you attached here, but I am not sure what I am supposed to do with it in order to see the problem. What kind of performance problem are you having? I clicked all four buttons on the form and they all appear almost instantaneously for me.
I have change my sample so the Form is Closed after shown, and added some Stopwaches.
On my System the form whitout Autosize of the Ultralabel (upper right Button 'no Label AutoSize') is shown about 7-10 times faster then the other versions. In my real Programm this cause a different from 0,5s to 5s and the user dont whant to wait 5s for a diaolg to be opend. So at the moment I workaround by don't using the AutoSize but it woud be very nice if i can use this so I can make my Layout a littel bit better.
I modified your sample to loop 10 times for each form, just so that the time difference would be more obvious. These are the results I got:
New Form + AutoSize: 00:00:05.4054519lokal Form + AutoSize: 00:00:04.4796534ArticleEditFormNotAutoSize: 00:00:00.7560133ArticleEditFormNoFill: 00:00:05.3347272
So ArticleEditFormNotAutoSize is much faster than the others. Is that about the same result you are getting?
I ran this through the Ants Performance Profiler and as best I can tell, the TableLayoutPanel is calling GetPreferredSize on the labels over 5000 times and this is the primary cause of the slow performance.
So I tried changing all of the UltraLabel control to the inbox Label on ArticleEditFormNoFill and the time was:
ArticleEditFormNoFill: 00:00:00.9000460
Slightly slower, but nowhere near as slow as UltraLabel. UltraLabel is more complex than the inbox Label, of course. So it's possible that it just needs more calculations and has to account for more things, but the time does seem excessive, so this is something we should look into. So I'm going to forward this over to Infragistics Developer Support and ask them to enter it as a bug for developer review.
yes that the same i got.
Thanks for forwarding this problem to Development.
I just wanted to let you know that we have looked into this issue and we made some performance optimizations that should help. You will receive an e-mail notifying you when the service release with the improvements is released.
We were not able to match the performance of the inbox Label, but we are a lot closer than we were, and in my testing, the performance improved about 100% (we cut the time in half).
One of the improvements we made is actually something you can do yourself without waiting for the service release. And in fact, doing it yourself will actually be better than what we are doing, because we don't necessarily know the proper synch points.
Part of the problem here involves the creation of a Graphics object to measure text. Right now, every time the FlowLayoutPanel calls GetPreferredSize, a new Graphics object is created. This takes a lot of time, and since the FlowLayoutPanel is calling GetPreferredSize a huge number of times, it's causing a serious slowdown.
To work around this, you can tell the Infragistics controls to cache their Graphics objects. You do this by using a couple of method on the Infragistics.Win.DrawUtility class.
When yoru application starts, before any controls are created, you call Infragistics.Win.DrawUtility.BeginGraphicsCaching and when your application is done, you call Infragistics.Win.DrawUtility.EndGraphicsCaching.
So in the sample you posted here, call the BeginGraphicsCaching in the form's constructor before the call to InitializeComponent. And then call the EndGraphicsCaching in the Dispose method of that form.
public Form1() { Infragistics.Win.DrawUtility.BeginGraphicsCaching(); InitializeComponent(); }
protected override void Dispose(bool disposing) { if (disposing) { if (components != null) components.Dispose(); Infragistics.Win.DrawUtility.EndGraphicsCaching(); } base.Dispose(disposing); }
Hello Wolfgang,
I have create a case for you with id CAS-58249-68BJXG. I will update you for the progress of this issue as soon as I have information for you.
Thank you.