SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
My group is evaluating SciChart for high performance realtime charting. We are testing line renderer with XyDataSeries.
We were able to get good performance, but we need to squeeze more and our scenario is a bit different from how XyDataSeries is used.
To make a long story short, we cannot append, because our application has 2 strict requirements:
which means put in XyDataSeries a new set of points at every step. This means either do:
var dataSeries = new XyDataSeries<double, float>(samples.Length) dataSeries.Append(domain, samples); m_renderableSeries.DataSeries = dataSeries;
dataSeries.Clear(); dataSeries.Append(m_domain, samples);
(btw, the first one is slightly faster, 190ms vs 240ms to draw 10 million points)
Which is obviously working against how XyDataSeries is implemented.
A faster way would be to just do
var dataSeries = new ReadOnlyXyDataSeries(domain, samples); m_renderableSeries.DataSeries = dataSeries;
Where ReadOnlyXyDataSeries just takes the samples array and without any copy makes it available to the renderer.
So I implemented ReadOnlyXyDataSeries as a IXyDataSeries<double, float>.
To my surprise however this performs much worse (900ms to draw 10
million points), while it should perform better (it is really just a
XyDataSeries without copy)
UPDATE: This is not true: I was setting IsSortedAscending = false on sorted data. Once I put it to true, preformances are back to exactly the same performance as XyDataSeries . Which is good but not stellar.
(hack time) I know there is room for performances, because I made the following (hacky, brutal, very bad) thing:
var internalList = (ISciList<float>)dataSeries.YValues; Array.Copy(samples, internalList.ItemsArray, samples.Length);
instead of the Clear/Append pair, and it is much faster (30ms are shaved off). No copy should be even faster.
Obviously I am missing something. So, what am I missing? How should I implement a custom IXyDataSeries in a fast way? Is there another way?