AstraExt/astra-monitor

Visible lag when switching between expanded panels in top bar

Closed this issue ยท 4 comments

Description

There is a noticeable lag when switching between expanded panels in the top bar.

I understand they render a lot of information, but it seems like they get removed completely and recreated from scratch every time because the lag doesn't improve when hovering over one that was opened before.

This doesn't happen for the tooltips and any other applications that register an entry in the top bar.

Steps to Reproduce

  1. Hover over e.g. CPU entry from Astra monitor
  2. Click it to open the panel
  3. Move between all the panels that Astra monitor offers
  4. Expect there to be a noticeable and distracting lag when doing so

Screenshots

It's not easy to see and the recording probably doesn't have enough FPS, but here we go:

Screencast.from.2024-04-09.06-52-08.webm

Environment

  • Astra Monitor Version: 18
  • GNOME Version: 45.2
  • Operating System and Version: Ubuntu 23.10
  • Other Relevant System Information:

Logs

Additional Context

This is actually intended and a design choice. In contrast to other system monitors, Astra Monitor is querying resources only when they are displayed, and that is why it is the lightest, highest performing, and weighs less on the CPU than the others.

When you open the menus, unfortunately, the data is loaded all at once and this can introduce some lag and even a small spike in CPU usage, especially if you fast move between several menus. Unfortunately, the choice was between polling all the information all the time (consider that while you are playing games or doing other activities, the other monitors are still burdening over the CPU for all the monitored resources even if you are not using them) or requesting them when needed. In the latter case there are two more options: when you open the menu you can try to provide data as soon as possible, creating that graphical stuttering, or you can show them in lazy mode and then have them appear after a margin of time that can be as much as 1 or 2 seconds later. I chose by default not to burden the CPU all the time but to show the information as soon as possible when the user needs it.

However, in the Roadmap is planned to add a way to have the user choose all 3 options, namely add continuous monitoring of all resources or lazy display that does not affect the UI. Also in the extension settings there will be a FAQ area that will explain all this stuff in detail.

I leave this open until the user has the choice of whether they want to privilege information, UI or CPU.

I understand the reasoning, it makes sense!

All the information is dynamic, so caching might also be out of the picture for a previously opened panel. Another option would be to show a loading spinner until all the information is there instead of the lag, but that can also be disruptive.

Thanks for working on Astra monitor, it's an amazing tool already, and I will do some contributions to it soonish ;)

We already have a cache and actually in the earliest versions, when opening the menus, the last read value was shown but later I preferred to clear the values until an updated one is read because it may deceive the user into believing that the cached value was the current one. Probably with the introduction of lazy reading maybe some sort of spinner will also be introduced if it will not require too much work.
Thank you, contributions are welcome!

I have just upgraded to v22 and don't encounter this issue anymore since it was improved in 23b5a14 and released as part of v20. Thanks, its really smooth now!