SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

All Answers » Re: XyDataSeries perfomance, custom IXyDataSeries, and alternatives » Comments for "Re: XyDataSeries perfomance, custom IXyDataSeries, and alternatives"
  • Andrew
    A couple other comments here. In the development of SciChart WPF we have written our own data structures (our own List type), our own highly efficient memcpy, Array.Min/Max implementations, we use pointer manipulation internally and C++ code for really performance critical sections. We’ve shaved nanoseconds off calls like List.Add() which when you call them tens of millions of times, they really add up. We can show you the best way to get the most out of DataSeries but it’s not easy to best that performance. The fastest & simplest way would be just a memcpy (Array.Copy is pretty good), but you need to make sure you’re caching and re-using memory (not recreate) a that is also expensive. If you implement IXyDataSeries, you must implement ToPointSeries() correctly as not resampling the data will result in much slower performance of drawing. Also things like XRange, YRange again we use optimal methods — internally SciChart calls these to setup Viewport sizes. There’s a lot going on there!
  • Lorenzo Dematte
    Thank you for your answer andrew. The point of having an array-backed implementation of a XyDataSeries is precisely to avoid the memcopy. We already have filled a double[] with values, so instead of allocating and copying (or clearing and copying) we would like to just use the array, shaving those 10ms (at least) off.
  • Lorenzo Dematte
    To answer you question (why you need to throw away the whole DataSeries): our values are calculated, and they depend on the whole dataseries. Think about B(i) = A(i) + Avg(A); every time a new point for A arrives, Avg(A) (may) change, so we have to re-compute all B(i). Essentially, that means throwing B away and recomputing it.
  • Andrew
    Hi Lorenzo, got it. DataSeries is also array backed, and you found the array via the X/YValues.ItemsArray property. You are free to manipulate this directly if you want (we also do it). Just be advised that (1). X/YValues.ItemsArray may be larger than DataSeries.Count. Always use DataSeries.Count when iterating in a loop. (2). secondly updates to X/YValues.ItemsArray won’t trigger recalculation of DataDistribution or the chart to redraw. You’ll have to do this yourself. You can’t at present create a DataSeries which wraps your own Array – it has been requested as a feature request. The reason is there are so many other calculations & optimsations we do it could just cause race conditions or other errors to wrap an array.
  • Andrew
    However … if you really need this, I can ask the dev team to look into it. We can carry out custom work for customers of SciChart so that they can get the best from our library. Do you want to talk to our sales about this? I can get someone to call you or email to discuss requirements. Best regards, Andrew
  • sheldon vestey
    Hi Lorenzo, you can get in touch via sales@scichart.com or personally to myself at sheldon@scichart.com to discuss custom work if you think your project would benefit from it. We also have a feature request system https://www.scichart.com/feedback-policy/ which customers can use to request features. As Andrew says, we are also working on a performance improvement which we can outline to you as well to see if that would benefit your project.
  • Lorenzo Dematte
    Thank your for your answers, very helpful. At this stage for us is not “we really need this”, but more like “can it be done”? We are knowningly pushing the boundaries to understand the limit and see if it can fit right now, it’s not sure we will need all the optimizations and options we are discussing.
  • sheldon vestey
    We think that what you want can be done but it’s a non-standard use of our library and would require some developer time to investigate and do a feasibility evaluation. We have a strict no mis-selling policy at SciChart so we always undertake full due diligence and if the task cannot be done we do not expect a sale. However, with all non-standard work, we would need to discuss order size before we can expend developer time! Let me know your thoughts and feel free to send me an email to discuss it further.