Page 1 of 1

Scatter plot efficiency and v3

Posted: Mon Jun 04, 2007 3:44 pm
by 9641603
Hi,

I would like to know if any improvements were made to the efficiency (speed) of drawing scatter plots in v3 of TeeChart. A year ago when we were considering the purchase of TeeChart I was told that such improvements would probably be added in v3 ;)
With current TeeChart for .NET v2 released version it took about 14 seconds to draw 500000 points. We also tested the application using our current sources which included several performance optimization, and will be included with the next releases, and it took 4 seconds.

We are also working in a GDI non-managed canvas for TeeChart for .NET which may improve its performance.

I have compared this application with its TeeChart VCL for Win32 and VCL.NET equivalent. The Win32 application run in 78 milliseconds while VCL.NET took 203 milliseconds. This leads us to think that an important part of this time of performance is because of the known slowliness of Microsoft's .NET Framework compared to Win32.
(this is from an e-mail sent on May 11, 2006)

Best,
Michal

Posted: Tue Jun 05, 2007 12:21 pm
by narcis
Hi Michal,

Yes, several enhancements were done for the first version and recently additional improvements have been implemented and will be included in the next v3 maintenance release, which we expect to be ready soon.

Below there's the code we used for the tests (very similar to the code I originally sent you) and the results I obtained here using Points series are 9671.875 milliseconds in version 2 and 4875 milliseconds in version 3.

For completeness, even you explicitly asked for Points series, we have also run the tests using FastLine series. FastLine took 1500 milliseconds in v2 and 625 milliseconds in v3.

Also please notice that in all test we used our latest v2 and v3 sources.

Code: Select all

		// number of points we'll be displaying
		const int maxpoints = 500000;

		private void button1_Click(object sender, EventArgs e)
		{
			double[] myX = new double[maxpoints];
			double[] myY = new double[maxpoints];

			System.Random r = new System.Random();
			double tmp = r.NextDouble() * 10000;
			for (int t = 0; t < maxpoints; t++)
			{
				tmp += r.Next(100) - 49.5;
				myX[t] = t;
				myY[t] = tmp;
			}

			// now add points to series  			
			points1.Add(myX, myY);
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			// Prepare chart for maximum speed:
			tChart1.Aspect.ClipPoints = false;
			tChart1.Header.Visible = false;
			tChart1.Legend.Visible = false;
			tChart1.Axes.Left.AxisPen.Width = 1;
			tChart1.Axes.Bottom.AxisPen.Width = 1;
			tChart1.Axes.Bottom.Labels.RoundFirstLabel = false;
			tChart1.Aspect.View3D = false;
			tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
			tChart1.Panel.Gradient.Visible = false;
			//tChart1.Walls.Back.Gradient.Visible = false;
			tChart1.Walls.Back.Visible = false;

			// set ordering to none, to increment speed when adding points
			points1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;

			// initialize axis scales
			tChart1.Axes.Bottom.SetMinMax(1, maxpoints);

			points1.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.SmallDot;
		}

		private long startTime, now;

		private void tChart1_BeforeDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			startTime = DateTime.Now.Ticks;	
		}

		private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			//calculate elapsed time
			now = DateTime.Now.Ticks;
			TimeSpan elapsedTime = new TimeSpan(now - startTime);

			label1.Text = "Elapsed time: " + elapsedTime.TotalMilliseconds.ToString() + " ms";
		}