|
Clearing ChartXY struct |
Posted by Herv? Thomy on Nov-19-2008 21:28 |
|
Hi,
We are experiencing some performance issues.
Our application must create a thousand of chart inside a report. Each time we create a new Chart, we have to delete the previous ChartXY and allocate a new one.
The thing is the deletion of the ChartXY takes about 40 or 50 ms. It takes about 50 ms to add dataset and save the chart into a png file.
Half time of our process is used to clean up the ChartXY. It's not very important for one chart, but we have to generate a thousand.
Is it possible to clear the chartXY struct without deletion ?
Does exist any other way to improve our process performance ?
Thanks,
Herv |
Re: Clearing ChartXY struct |
Posted by Peter Kwan on Nov-20-2008 01:15 |
|
Hi Herv?,
From my understand, it takes negligible time to create the chart object, and add delete the chart object.
However, it does take some time to create the PNG file. A typical chart may around 10ms to 100ms depending on the number of pixels on the chart. It is usually CPU bound, and the majority of the time is spent in real time data compression (to compress the hundreds of thousands of true color ARGB pixels to a few K bytes).
Clearing the XYChart structure will not resulting in any difference in performance, as creating the deleteing the XYChart structure should take negligible time (should be in the order or microseconds or less). In any case, you still need to create the PNG file.
Generally speaking, from the feedback of a lot of our customers, the speed of ChartDirector should be quite fast. The above mentioned performance level (10ms to 100ms) is not slow for realtime PNG chart creation.
If you suspect creating and deleting the chart objects are taking significant amount of time, you may perform the following test:
- Create the chart object. Add some hard coded data to it. (Do not get your data from your database, otherwise you may be measuing your database performance, not the charting performance). Configure the chart as usual. However, do *not* output the PNG. Just delete the chart.
- Use a loop to repeat the above process 100000 times. Make sure the code is compiled in release mode, and is executed from the DOS shell (not inside the development environment or debugger, as the debugger will slow down the code). Make sure your code does not do anything else (such as printing to the console or stdio) to get an accurate performance measure.
I suspect the above will take less than 100 seconds, proving that creating and deleting the chart together takes less than 1 ms. (The exact time depends on the CPU power of your computer and the number of pixels in the chart).
You can then repeat the above code with PNG created and set the loop for iterate 1000 times. Please use the same file name for the 1000 PNG files created. (If you use different file names, you may be testing the performance of your hard disk, not the charting code. If you use the same file name, the file will be in disk cache, so the majority of the CPU time is used by the charting code.) If you see a performance in the order of 10ms to 100ms per chart (depends on the CPU power of your computer and the number of pixels in the chart), it is normal, and is already quite fast.
Finally, you may test using real data from your database and using different file names for the 1000 PNG files. If it takes significantly longer time, the time should be related to the performance of the database or the file system.
Hope this can help.
Regards
Peter Kwan |
Re: Clearing ChartXY struct |
Posted by Herv? Thomy on Nov-20-2008 19:17 |
|
Hi Peter,
I'm so sorry to have open this thread. Unfortunately, I made all my tests time with a debug version. What a shame !!!
Thank you for you quick answer.
Herv |
|