Performance: interactivity is slow if Visual.Render() is overridden
See original GitHub issueBug Description: When display a huge amount of points, ScottPlot is lagging a lot, especially when you’re trying to move in the graph
Reproducing:
AvaPlot plot = this.FindControl<AvaPlot>("Plot");
var random = new Random();
plot.Plot.AddScatter(
xs: Enumerable.Range(0, 10000).Select(x => (double)x).ToArray(),
ys: Enumerable.Range(0, 10000).Select(x => (double)random.Next()).ToArray()
);
System Information
- ScottPlot Version: 4.1.16
- Operating System: Windows 11 / Ubuntu 20.04
- Application Type: Avalonia
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Slow rendering | App quality
If your app suffers from slow UI rendering, then the system is forced to skip frames and the user perceives stuttering in your...
Read more >Terrible performance of custom-drawn control
I found this question first, which become normal render-based graph (use InvalidateVisuals() to redraw). protected override void OnRender( ...
Read more >CSS performance optimization - Learn web development | MDN
This article walks you through key CSS performance optimization ... and it is easy to override styles when needed later on if the...
Read more >Baseline performance of rendering components is "slow"
Basically the issue I've run into is that it takes around 0.3-1.5 ms to render a component. In this case just a component...
Read more >Performance features reference - Chrome Developers
A reference on all the ways to record and analyze performance in Chrome DevTools.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am unfamiliar with your overriding of
Visual.Render(DrawingContext context)
inMainWindow.axaml.cs
. I wonder ifVisual.Render
is called everytime that the control needs to be redrawn. This is bad, because you’re initializing a lot of data in this function.I would move all of it to the constructor, or another function guaranteed to be called only once on startup.
Also I’m a little confused about an
AvaPlot
being used in a Windows WPF project. I would have expected to see aWpfPlot
🤔I don’t have much Avalonia experience though. Is this a mistake, or is there some cross-platform fanciness going on here?
EDIT: I was mistaken. This isn’t a WPF project, and the original issue says this is an Avalonia project. The
WinExe
line threw me off. My bad!