Infragistics4.Win.UltraWinGrid.v17.2, Version=17.2.20172.2006
I'm still fighting with slow UltraGrig performance. I've found that the UltraNumericEditor constructor has a bad performance, see the picture below. Is there a fix or work around for this issue, please? Thanks.
Hello and thank you for contacting Infragistics. What triggers the issue? I will require some more info, a sample and a profiling session.
Please clarify how you are using/embedding the UltraNumericEditor in the UltraGrid.
Update: Seems, the performance degradation depends on the number of instances created.
const int iterations = 100000; var list = new List<UltraNumericEditor>(); for (var i = 0; i < 30000; i++) { var ee = new UltraNumericEditor() { NumericType = NumericType.Decimal }; list.Add(ee); } GC.Collect(); var stopwatch = Stopwatch.StartNew(); for (var i = 0; i < iterations; i++) { var ee = new UltraNumericEditor() { NumericType = NumericType.Decimal }; } stopwatch.Stop(); var editorMs = stopwatch.ElapsedMilliseconds; var editorTicks = stopwatch.ElapsedTicks; stopwatch.Reset(); GC.Collect(); stopwatch.Start(); for (var i = 0; i < iterations; i++) { var o = new object(); } stopwatch.Stop(); Debug.WriteLine($"e: {editorMs}/{editorTicks}, o: {stopwatch.ElapsedMilliseconds}/{stopwatch.ElapsedTicks}");
e: 30170/301703785, o: 0/3215
I've never personally heard about this validation before, nor think this should have anything to do with performance. But also doesn't that only work if the Infragistics tools are installed on the machine locally? I am not sure checking for a valid license makes sense in production. This was previously discussed here:https://www.infragistics.com/community/forums/f/general/81047/how-to-check-if-there-is-developer-license-on-a-computer
Seems, the issue is deeper than I originally expected.
public class UltraControlBaseChild : UltraControlBase { protected override ControlUIElementBase ControlUIElement { get; } }
const int iterations = 100000; var list = new List<UltraNumericEditor>(); for (var i = 0; i < 30000; i++) { var ee = new UltraNumericEditor() { NumericType = NumericType.Decimal }; list.Add(ee); } GC.Collect(); var stopwatch = Stopwatch.StartNew(); for (var i = 0; i < iterations; i++) { // var ee = new UltraNumericEditor() // { // NumericType = NumericType.Decimal // }; // var ee = new MyUltraWinEditorMaskedControlBase(); var ee = new UltraControlBaseChild(); } stopwatch.Stop(); var editorMs = stopwatch.ElapsedMilliseconds; var editorTicks = stopwatch.ElapsedTicks; stopwatch.Reset(); GC.Collect(); stopwatch.Start(); for (var i = 0; i < iterations; i++) { var c = new Control(); } stopwatch.Stop(); Debug.WriteLine($"e: {editorMs}/{editorTicks}, c: {stopwatch.ElapsedMilliseconds}/{stopwatch.ElapsedTicks}");
e: 26797/267972903, c: 280/2807863
I.e. UltraControlBase constructor is almost x100 slower than its parent's Control constructor.
Hello,
I suggest following the recommendation from this post.
https://www.infragistics.com/community/forums/f/ultimate-ui-for-windows-forms/93012/ultrawingrid-cell-different-input-masks
Instead of creating thousands of instances of UltraNumericEditor you can create a list of settings with masks and other related settings and then apply it to the editor that is assigned to the cell in the InitializeRow event.
The sample attached has 1 instance with two separate mask inputs assigned in the same column.
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { if (!e.ReInitialize) { if (e.Row.Cells[0].Column.EditorComponent.GetType() == typeof(UltraNumericEditor)) { if (e.Row.Index == 0) { EmbeddableEditorBase editor = this.EditorCache.GetEditor("n"); e.Row.Cells[0].Editor = editor; } if (e.Row.Index == 1) { EmbeddableEditorBase editor = this.EditorCache.GetEditor("nn.nn"); e.Row.Cells[0].Editor = editor; } } } }
1401.WindowsFormsApp2.zip
Well. Thanks for the work-around. However, are you sure that no side-effects occur if a single editor instance is attached to a lot of cells?
And also it's still not clear why the base class (UltraControlBase) ctor is so slow? Doesn't that affect the whole library performance?
You should be using 1 editor per column as I demonstrated and N number of settings applied. How many Editor eg. InputMask related settings combinations to you have? Rather than create a control per setting you would just incorporate the sample code to add however many Editor related settings and apply them to the cells conditionally based on your business logic stored from the dataitem or an external list/dictionary that you can pull from rather than dedicating a new instance of an editor with settings required.
I don't think you would be experiencing any performance issues if you implement my suggestions and if the issue persists let me know and we can investigate this further.