Performance


#1

Hi,

Has anyone any experience of how GoDiagram for .NET performs when say 2000 plus objects / shapes on screen are being modified (all at once), for example colour change and change of text associated with the shape

I have previously evaluated a number of other GDI based products and while many look great we were let down by their performance. For example if I had 2000+ objects / shapes on the screen and we needed to update text or the colour (or both) associated with all the objects/shapes the performance wasn’t good enough. This is important as I need to run a transient simulation and would like to dynamically represent the results on screen (for each shape), as the transient analysis progresses. Does anyone have any experience with GoDiagram being used in this manner, how well would it perform (rough idea) ??. I have done some benchmark tests and it looks pretty good. Lack of performance for this feature has led us to look at OpenGL based products but I would prefer the .NET GDI route as it would be much quicker and easier for me to implement.

many thanks.

<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


#2
Here's an example class for displaying a numerical state, with a non-trivial shape (a pie), a textual value, and a label, with a rectangle background. Running with 2500 instances doesn't seem to be a problem. I'm running with GoDiagram version 2.2 beta, which does have some performance improvements, although I don't think that matters here. [Serializable] public class Indicator : GoGroup { public Indicator() { this.Resizable = false; // to avoid having to implement LayoutChildren this.Copyable = false; // to avoid having to implement CopyChildren GoRectangle r = new GoRectangle(); r.Selectable = false; r.Bounds = new RectangleF(0, 0, 40, 40); r.Brush = Brushes.LightGray; Add(r); GoText t = new GoText(); t.Selectable = false; t.Alignment = Middle; t.SetSpotLocation(MiddleTop, new PointF(20, 42)); t.Top += 2; Add(t); myLabel = t; GoPie p = new GoPie(); p.Selectable = false; p.Bounds = new RectangleF(4, 4, 32, 32); p.Brush = Brushes.Green; p.Pen = null; p.StartAngle = 90; Add(p); myPie = p; GoText v = new GoText(); v.Selectable = false; v.Alignment = Middle; v.Center = p.Center; Add(v); myValue = v; } public float Value { get { return myPie.SweepAngle; } set { myPie.SweepAngle = value; myValue.Text = myPie.SweepAngle.ToString(); } } public String Text { get { return myLabel.Text; } set { myLabel.Text = value; } } private GoText myLabel = null; private GoPie myPie = null; private GoText myValue = null; } In your Form, with a MenuItem to create the indicators, and one to start or to stop the animation: private Indicator[,] myIndicators = new Indicator[50, 50]; public Random myRandom = new Random(); private System.Threading.Timer myTimer = null; protected void MakeIndicatorsMenuItem_Click (object sender, System.EventArgs e) { myView.StartTransaction(); for (int i = 0; i < 50; i++) { for (int j = 0; j < 50; j++) { Indicator ind = new Indicator(); ind.Position = new PointF(i*50, j*60); myIndicators[j, i] = ind; myView.Document.Add(ind); ind.Text = i.ToString() + ", " + j.ToString(); ind.Value = myRandom.Next(300); } } myView.FinishTransaction("added Indicators"); } // start or stop the animation private void AnimationMenuItem_Click(object sender, System.EventArgs e) { if (myTimer == null) { myTimer = new System.Threading.Timer(new System.Threading.TimerCallback(timer_Callback), null, 333, Timeout.Infinite); } else { myTimer.Change(Timeout.Infinite, Timeout.Infinite); myTimer.Dispose(); myTimer = null; } } // this might get called in any thread private void timer_Callback(object target) { if (myView.InvokeRequired) { Invoke(new EventHandler(timer_Tick)); } else { timer_Tick(null, EventArgs.Empty); } } // this should always run on the Form's/GoView's thread private void timer_Tick(object sender, EventArgs evt) { GoDocument doc = myView.Document; doc.SkipsUndoManager = true; for (int i = 0; i < 50; i++) { for (int j = 0; j < 50; j++) { Indicator ind = myIndicators[j, i]; ind.Value = myRandom.Next(300); // assign a new value } } doc.SkipsUndoManager = false; }