ScottPlot: ScottPlot5 Avalonia control is very slow on Linux

Question: ScottPlot5 skiasharp is terribly slow on Linux (Debian 12 (linux-x64), i3-10105, Intel UHD Graphics 630).

ScottPlot.Avalonia Version: 5.0.21 SkiaSharp.NativeAssets.Linux.NoDependencies Version: 2.88.7 Avalonia Version: 11.0.6

Code Sample:

<ScottPlot:AvaPlot Name="avaPlot1"/>
        avaPlot1.Plot.Title("UDP data graf");

        avaPlot1.Plot.XLabel("Time [s]");
        avaPlot1.Plot.ShowLegend();

        // create a timer to update the GUI
        _renderTimer = new DispatcherTimer();
        _renderTimer.Interval = TimeSpan.FromMilliseconds(20);
        _renderTimer.Tick += Render;
        _renderTimer.Start();
void Render(object sender, EventArgs e) {
avaPlot1.Refresh();
}

When I use ScottPlot4 or ScottPlot5 on Windows then the UI page with the Scottplot plot performance is smooth and fast. The Scottplot5 is even faster than Scottplot4 on Windows. When I use the same on Linux (same machine) then the application is terribly slow, regardless the refreshing render time period. Scottplot4 performance is satisfactory on Linux.

The rendering time (FPS) get by dobble-click in graph is more than 100 times worse on Linux.

  • I am using dotnet 6.0. Build command: dotnet publish -r linux-x64 -c Debug -p:publishsinglefile=true --self-contained true

The following packages libfreetype6, libfontconfig1 and fontconfig have been installed.

I am curious whether the Scottplot5 is using the GPU acceleration or what I am doing wrong.

Thank you for support.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Why do we need to recreate it every time it’s not found?

It just so happened 🤷😊

Wouldn’t it be more efficient to cache the default FontName when an instance of a missing FontName occurs?

PR #4250 should just fix this situation.

- return SystemFontResolver.CreateDefaultTypeface();
+ SKTypeface defaultTypeface = SystemFontResolver.CreateDefaultTypeface();
+ TypefaceCache.TryAdd(typefaceCacheKey, defaultTypeface);
+ return defaultTypeface;

Fixed in 5.0.35 by #3841

I am having the same issue and ran some testing.

  • RHEL 8.8
  • Avalonia version 11.0.7

With my application, downgrading to 5.0.18, the application is running at around 8% of a single core. When upgrading > 5.0.18, the same exact application is maxing out a single core which is causing the plotting to essentially freeze.

render speeds using same data stream for a signalXY

  • 5.0.18 ~1 ms
  • 5.0.21 ~300 ms

Almost seems like there is an infinite loop or some thread running without a sleep/wait in a render thread

Hello, @krabicka04, I am experiencing the same behavior, rendering speed of 4 FPS (~300ms) on Debian. Have you solved this or managed to improve the performance?

BR