Replies: 4 comments 14 replies
-
Any suggestions? :) |
Beta Was this translation helpful? Give feedback.
-
I think I may be seeing some potential issues:
For the first option, I know there is no alternative API and we need to add one that uses a span. However, even with the nice fast span, the backing/source collection also needs to be accessible via an array - this may help: https://learn.microsoft.com/dotnet/api/system.runtime.interopservices.collectionsmarshal.asspan If you try the new GPU-backed view in 3.x, is it faster? Besides all this, trying to draw 200k points is also sometimes less useful if the points are off the screen. It may be worth breaking the points up into regions. For example, if the total chart is holding points in a visible region of 500x300px, then it may be useful to break the points into boxes of 100x100px and just drawing those. This does not solve the case where all the points are visible, but it may help with panning. You may also want to look at merging points at very zoomed out levels. Instead of drawing 7 points in a single pixel or even a 3x3px area, just draw one. This will involve processing the point data, but drawing less is always faster. I know some of this does not help you now, but the GPU accelerated view may help. If the point collection is fixed, then it may be worth creating the array one time to pass to the points method, then it does not matter about array vs span vs anything, there is a single, long-lived array instance. EDIT: I also just realized the |
Beta Was this translation helpful? Give feedback.
-
Thanks I did specifically mention the array allocations in the original question (I tested with a static array and it made no noticeable difference). And yep, I recently tried SKGLElement, but sadly, made no noticeable difference. I agree with all your other points about approaching the problem from another angle by simplifying the point collection, and that is something I will probably do, but it was more a question to see if there was anything lower level I could use. 200k might sound like a lot, .. but by todays hardware really isn't that much work (even if the points are polygons). Im guessing that each point is tessellated on the CPU? as opposed to it being tessellated on the GPU? And of course, I appreciate that I am probably expecting too much from this library, (trying to use it for something it wasn't intended for) which of course is fair enough :) |
Beta Was this translation helpful? Give feedback.
-
If you don't need to support Web UI, you could use OpenGL library instead, e.g. this one |
Beta Was this translation helpful? Give feedback.
-
I'm working on a custom WPF control that displays a scatter point chart, showing upwards of 200k points. This chart is interactive, meaning the user can pan, scroll, zoom etc and the rendering will update.
However, the performance when trying to render such a large number of points is pretty poor, and the interactive element is ... less interactive than I would like (as its so laggy)
I am currently using SKCanvas.DrawPoints, and the documentation specifically mentions that points are rendered "one at a time". I was wondering if there is some other method I could be using? perhaps something that uses some kind of geometry instancing? (i.e one draw call, multiple data)
Some information about my use case
Some things I have noticed :
One option would be to dynamically to switch from round to square depending on the number of points.
Here is some example code for what I am doing.
NOTE : The memory allocation of creating the points each time is not the bottleneck, it is the render call that takes all the time. But I have written it like this as it keeps the example code simple.
Beta Was this translation helpful? Give feedback.
All reactions