ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  addCandleStickLayer() can't accept containers for high,low,min,max data
Posted by Roman Gavrilov on Nov-13-2009 01:35
Is there a way to pass Container to this method instead of double array?

The issue that is very expensive to move array (4 arrays) each time new data arrives.
Today when you want to add another bar you need to shift all arrays which is very expensive from performance perspective.
I would rather create a linked list and pass it or pass Iterator range to the method, this would save me the need to shift arrays each time new data arrives.

  Re: addCandleStickLayer() can't accept containers for high,low,min,max data
Posted by Roman Gavrilov on Nov-13-2009 01:38
This is related to .NET API, haven't checked other APIs.

  Re: addCandleStickLayer() can't accept containers for high,low,min,max data
Posted by Peter Kwan on Nov-13-2009 02:59
Hi Roman,

Actually, shift data in arrays are very cheap, especially in .NET (which is based on compiled languages, not interpreted languages). The time usually is so small that it is not measurable, compared to the time to update the chart. Have you actually measured the performance?

Regards
Peter Kwan

  Re: addCandleStickLayer() can't accept containers for high,low,min,max data
Posted by Roman Gavrilov on Nov-13-2009 03:06
I doubt that its a negligible performance hit if you rotate big arrays every 250 msec or so.
In addition it is lots of unnecessary CPU spins, and if you want to update your chart every second or every .5 second and you have 4 arrays that can have thousands of records that would be a performance hit, and unnecessary one as if it was specialized container (for example linked list with head and tail) that would have involved only few operation to move the data.

Roman

  Re: addCandleStickLayer() can't accept containers for high,low,min,max data
Posted by Peter Kwan on Nov-13-2009 14:22
Hi Roman,

In a modern computer, the CPU is capable of moving a million bytes per millisecond.

Actually, the absolute CPU used in moving the data is not important. The most important factor is the CPU used relative to drawing the chart.

I am not sure what is your actual data set. It is uncommon to draw thousands of candlesticks on the chart. But suppose you really want to draw thousands of candlesticks on the chart. You can compare the CPU resource required to move one set of high/low/open/close data value, with the CPU resource required to draw one candlestick (which contain many pixels, and some calculations). You can see the CPU resource to move the one set of data values (which are extremely small) are negligible compare to the CPU resource to draw one set of data values as a candlestick.

If you have many data values to move, you also have equally many candlesticks to draw. So the comparison result is still the same, that is, the CPU resource to move the data values is negligible compared to drawing the data values. If you need to move the data values many times per second, you also need to draw the candlesticks many times per second, and the comparision is still the same.

In other words, no matter how much data you have, and how frequent you move the data, the CPU usage is always negligible as long as you also need to draw the data.

Hope this can clarify why it is not necessary to worry about the CPU usage in shifting the data.

Regards
Peter Kwan

  Re: addCandleStickLayer() can't accept containers for high,low,min,max data
Posted by Roman Gavrilov on Nov-13-2009 17:43
ok, thank you for the info.