flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
24.02k stars 1.53k forks source link

`flameshot gui` performance issues #3419

Open Troplo opened 7 months ago

Troplo commented 7 months ago

Flameshot Version

v12.1.0, f0430e0

Installation Type

Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...), User repository (AUR), Compiled from source

Operating System type and version

Arch Linux, Linux 6.6.2, X11, KDE Plasma 5.27.9, NVIDIA

Description

I've noticed the performance of running flameshot gui isn't ideal as it doesn't appear to forward the request to the existing Flameshot instance, and rather spawns an entirely new instance, which I guess is what you'd expect if you run flameshot, but it's not ideal when you've bound that command to a keybind and execute it regularly. It usually causes lag in games as well right before the instance is able to initialize.

I made a change to Flameshot in PR #3408 and found it drastically improves performance. I measured the initialization time by adding qputenv("FLAMESHOT_INIT_TIME", QByteArray::number(QDateTime::currentMSecsSinceEpoch())); to the first line of main(), and in the DBus adapter function and measured the difference after the widget initializes, perhaps there's a better way to measure it but I think it demonstrates the difference.

I measured 350-420ms for flameshot gui and 20-70ms for the DBus function.

Steps to reproduce

  1. Run flameshot gui and notice the initialization time.

Screenshots or screen recordings

Screenshot showing init times

DBus in game frametime: Screenshot with DBus alternative

flameshot gui in game frametime: Screenshot with normal method

(KDE Compositor was disabled for in game demonstration)

System Information

  1. Arch Linux, Linux 6.6.2, X11, KDE Plasma 5.27.9, NVIDIA
  2. 1080p and 4K monitor setup respectively
  3. X11