Bug 476707 - Bad performance on XY plot with ~200k data points
Summary: Bad performance on XY plot with ~200k data points
Status: RESOLVED FIXED
Alias: None
Product: LabPlot2
Classification: Applications
Component: frontend (other bugs)
Version First Reported In: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Alexander Semke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-08 09:48 UTC by chrismettal
Modified: 2024-02-22 22:09 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 2.11
Sentry Crash Report:


Attachments
Raw, unmodified source data example (2.75 MB, text/csv)
2023-11-08 09:48 UTC, chrismettal
Details
"Broken" plot with infinite ticks (13.70 KB, image/png)
2023-11-08 09:50 UTC, chrismettal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description chrismettal 2023-11-08 09:48:24 UTC
Created attachment 162944 [details]
Raw, unmodified source data example

SUMMARY

Creating an XY plot of a ~200,000 double data points kills performance of LabPlot. One CPU core will get stuck on 100% and almost no interaction will be possible.

This seems to be caused by the automatic Y ticks being set to 10 major ticks and 1 minor tick, resulting in one tick per data point, as turning off ticks results in great performance.


STEPS TO REPRODUCE
1. Load in example source data as a spreadsheet
2. Remove columns 1 2 and 4 as they contain garbage data
3. Remove lines 1-4 as they contain garbage data
4. Create a new column with row numbers
5. Create an XY Plot with the row numbers on X and the double values on Y

OBSERVED RESULT

The plot is generated, but is fully "highlighted" with infinite ticks in Y. Labplot basically hardlocks with 100% CPU usage.

EXPECTED RESULT

The plot is generated and performance stays good.

SOFTWARE/OS VERSIONS
```
Debug build 
Sep 30 2023, 22:50:57
System: Arch Linux
Locale: C,Default (Decimal point '.', Group separator ','
Number settings: Decimal point '.', Group separator ',', Exponential 'e', Zero digit '0', Percent '%', Positive/Negative sign '+'/'-' (Updated on restart)
Architecture: x86_64-little_endian-lp64
Kernel: linux 6.5.9-arch2-1
C++ Compiler: GNU 13.2.1
C++ Compiler Flags: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/labplot/src=/usr/src/debug/labplot -flto=auto -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Werror=init-self -Wvla -Wdate-time -Wsuggest-override -Wlogical-op -Wall -Wextra -Wundef -Wpointer-arith -Wunreachable-code -Wunused -Wdeprecated-declarations -fno-omit-frame-pointer -fstack-protector -fexceptions -std=c++11 -O2 -Wcast-align -Wswitch-enum -fvisibility=default -pedantic -Wzero-as-null-pointer-constant
```

```
                   -`                    chrismettal@mainframe 
                  .o+`                   --------------------- 
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Host: X670E Steel Legend 
               `+oooooo:                 Kernel: 6.5.9-arch2-1 
               -+oooooo+:                Uptime: 23 hours, 49 mins 
             `/:-:++oooo+:               Packages: 1367 (pacman), 102 (flatpak) 
            `/++++/+++++++:              Shell: bash 5.2.15 
           `/++++++++++++++:             Resolution: 3440x1440 
          `/+++ooooooooooooo/`           DE: Plasma 5.27.9 
         ./ooosssso++osssssso+`          WM: KWin 
        .oossssso-````/ossssss+`         WM Theme: Breeze 
       -osssssso.      :ssssssso.        Theme: [Plasma], Dracula [GTK2/3] 
      :osssssss/        osssso+++.       Icons: breeze-dark [Plasma], breeze-dark [GTK2/3] 
     /ossssssss/        +ssssooo/-       Terminal: konsole 
   `/ossssso+/:-        -:/+osssso+-     CPU: AMD Ryzen 9 7950X (32) @ 5.881GHz 
  `+sso+:-`                 `.-/+oso:    GPU: AMD ATI 18:00.0 Raphael 
 `++:.                           `-/+/   GPU: AMD ATI Radeon RX 7900 XT/7900 XTX 
 .`                                 `/   Memory: 10676MiB / 63410MiB 
```
Comment 1 chrismettal 2023-11-08 09:50:50 UTC
Created attachment 162945 [details]
"Broken" plot with infinite ticks
Comment 2 Martin 2023-11-09 13:22:58 UTC
When I follow your steps it looks fine for me, I have 4 ticks. Did you change also the MajorTicks Type or did it happen automatically?
Comment 3 Martin 2023-11-09 13:26:23 UTC
Steps to reproduce:

1) Create Data in Spreadsheet:
200.000 rows, 2 columns
2) Fill first column with rownumber
3) Fill second column with random numbers
4) Create Plot (Plot range is 0...1)
5) Change Axis Spacing to 0.1
6) Add curve to plot

Expected:
No hang

Observed:
Hangs
Comment 5 chrismettal 2023-11-10 08:31:28 UTC
(In reply to Martin from comment #2)
> When I follow your steps it looks fine for me, I have 4 ticks. Did you
> change also the MajorTicks Type or did it happen automatically?

This is a fresh install with no changes made to any settings other than changing the default theme to DarkPastels. 
Reading the theme files, it seems it sets grid/tick styles automatically. Maybe the auto tick limiting doesn't apply after the themes correctly?