Performance |
Post Reply |
Author | |
cpede
Senior Member Joined: 13 August 2004 Location: Denmark Status: Offline Points: 668 |
Post Options
Thanks(0)
Posted: 12 April 2011 at 10:52am |
Now I finally changed my existing ComponentOne Chart graph component with the CXTPChart component. My first experience is, that I really hope that I do something very wrong, since the performance is very bad compared. My main loop for updating data is like this: SetUpdateWindow(FALSE); The remove and the loop takes around 6 seconds to run! What can I do to boost performance, Component Chart uses 750 msec for the same action! The time measurements are made in debug builds, so I guess that the performance is slightly better in release. -cpede |
|
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64) Language: Visual Studio 2017 (C++) |
|
Tomasz
Senior Member Joined: 05 August 2006 Status: Offline Points: 109 |
Post Options
Thanks(0)
|
It is not surprising that chart component is slow given its current architecture (each data point being a separate object created on heap). new operator is slow. My in-house developed charting components can add 3 *million* data points and draw candlestick chart with 3 million bars in under 0.15 seconds. But it is written in pure C and it allocates one contiguous array for all data points at once (in one HeapAlloc call). If you want speed there is no choice - you have to write code yourself. I am yet to see any commercial chart component that delivers performance required for demanding real-time charting applications. |
|
cpede
Senior Member Joined: 13 August 2004 Location: Denmark Status: Offline Points: 668 |
Post Options
Thanks(0)
|
Well, looking at the .NET-like object way CodeJock has implemented it you are right.
But I must say that I'm actually very disappointed. I', using C++/MFC because of the performance. I have a lot of colleagues writing C#/.NET code and every time I can out-perform regarding performance and efficiency. And thanks to CodeJock I can also make GUI code just as fast as they can. When CodeJock then comes out with a chart control I was actually expecting performance, but what we got was just another slow chart component, probably good for financial charts with up to 100 samples. You can find a trillion of these kind of component on the Internet, good looking but with bad performance. I will go back to ComponentOne Chart until CodeJock at least comes close to that performance. -cpede
|
|
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64) Language: Visual Studio 2017 (C++) |
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
there are several things you could do perhaps to speed up your loop. 1. Don't call m_pSeries->GetPoints() each loop, cache the result 2.Tell the array how many points beforehand (CArray::SetSize()) so it doesn't need to do 20000 reallocs Cheers Adrien |
|
cpede
Senior Member Joined: 13 August 2004 Location: Denmark Status: Offline Points: 668 |
Post Options
Thanks(0)
|
Can I do anything to replace the pPoints->RemoveAll() call, if I know that I just need to fill it up again? Maybe with less points?
-cpede
|
|
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64) Language: Visual Studio 2017 (C++) |
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
I wouldn't have thought RemoveAll would be that expensive. Have you tried tracing tick counts to see how long it even takes?
|
|
cpede
Senior Member Joined: 13 August 2004 Location: Denmark Status: Offline Points: 668 |
Post Options
Thanks(0)
|
You are right, and the changes you proposed did not do anything for the performance either. Adding and removing seems to just add and remove from an array, and this is ok fast.
The problem is the drawing or rendering:
Enabling the performance counter already added in XTPChartControl gives the following result
CXTPChartControl::OnPaint: 150957246
for 3 CXTPChartFastLineSeriesStyle series with 10000 samples each.
Which gives approx. 10.5 sec. !
-cpede
|
|
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64) Language: Visual Studio 2017 (C++) |
|
m.geri
Newbie Joined: 24 July 2008 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
|
|
m.geri
Newbie Joined: 24 July 2008 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
I tried to add 10,000 points to the Fast Line sample with 5 lines and it works quite well probably because the view range on X axis is 100 points. Increasing the number of points of view range to 1000 painting and scrolling is very slow and graph that is obtained is not readable because the lines overlap with each other. One solution could be to be able to to set the maximum number of data points displayed at once. If the viewer, for example using zoom, selects a period that contains more data points than that this number, the chart groups data into longers periods using a "grouping" function (for example average). |
|
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
Sadly I agree about performance - having looked at the code I see why. I would like to see much better performance - I'm sure Codejock can increase speed by at least an order of magnitude. Performance at the moment is horrible but visually it's great !
|
|
Simon HB9DRV
|
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Thanks for the feedback, we are currently looking into the best approach to speed things up.
|
|
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
I'm sure you'll do it - keep up the good work, my users love it.
|
|
Simon HB9DRV
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |