NicolasConstant / sengi

Mastodon & Pleroma Multi-account Desktop Client
https://nicolasconstant.github.io/sengi/
GNU Affero General Public License v3.0
534 stars 35 forks source link

CPU Usage > 100% constantly #522

Open markmandel opened 1 year ago

markmandel commented 1 year ago

Sengi version: 1.2.0

❯ lsb_release --all
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux bookworm/sid
Release:        n/a
Codename:       bookworm

I run 6 columns:

  1. home
  2. local timeline (account 1)
  3. local timeline (account 2)
  4. local timeline (account 3)
  5. Hashtag query
  6. Hashtag query

Sengi usually takes up around 150-350% cpu on my 8 core machine.

Visualising with btop:

image

While Running Sengi:

image

Then, after I exit it: image

Not sure what I can do to profile, but happy to do so if it helps.

Some ideas:

Still love Sengi, but struggling to keep it open all the time with this CPU usage.

NicolasConstant commented 1 year ago

Weird. What build are you using?

markmandel commented 1 year ago

Sengi version: 1.2.0, installed from deb.

One thing I did notice when I installed the deb, was that it seemed like it was installing the 1.1.4 version:

❯ sudo gdebi  Sengi-1.2.0-linux.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Reading state information... Done

A multi-account desktop client for Mastodon and Pleroma
Do you want to install the software package? [y/N]:Y
/usr/bin/gdebi:113: FutureWarning: Possible nested set at position 1
  c = findall("[[(](\S+)/\S+[])]", msg)[0].lower()
(Reading database ... 560903 files and directories currently installed.)
Preparing to unpack Sengi-1.2.0-linux.deb ...
Unpacking sengi (1.1.4-1087) over (1.1.4-1087) ...
Setting up sengi (1.1.4-1087) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for mailcap (3.70+nmu1) ...
Processing triggers for gnome-menus (3.36.0-1) ...
Processing triggers for desktop-file-utils (0.26-1) ...
NicolasConstant commented 1 year ago

Yeah the electron build can be another version but it has no importance: the version of Sengi is the one loaded in the UI/Settings.

Can you try the webapp version to check if it's an Electron issue or something linked to a script going crazy?

markmandel commented 1 year ago

That gave me a good idea - here is a 1 minute profile of the Electron App, to see if you can see anything that stands out. profile.zip

markmandel commented 1 year ago

So I just installed Sengi as a PWA - and wow, so much less CPU usage!

image

image

image

So clearly that's how I'll be using it form now on 😄

But I also found something else out that I think is a big culprit.

(Going back to the Electron App)

My fourth column is a search for #gamedev - and if I remove that, CPU usage drops to 10-30% (totally acceptable levels)

I don't know if it's just because that has way more gifs and videos, or it's a popular tag, or what - but it makes a huge difference if it's there or not.

image

markmandel commented 1 year ago

The plot thicks further! I left it running for a while, and the PWA started showing way more CPU usage (similar to the electron app)!

image

So it definitely gets worse over time.

I dropped the #gamedev column, and saw a big CPU drop (although still ~90% or so). I'm thinking it's something to do with hashtag columns, and maybe ones that tend to be gif/video heavy.

image

If I reload the PWA page, then CPU also drops back down - so it does seem incremental over time.

image

rpetti commented 1 year ago

I think each column will keep at least 40 posts loaded at all times, and I don't believe it will pause playback when posts aren't visible. Could that account for the large CPU usage? I also wonder if GPU acceleration (or the lack thereof) is a factor here.

markmandel commented 1 year ago

I think each column will keep at least 40 posts loaded at all times, and I don't believe it will pause playback when posts aren't visible. Could that account for the large CPU usage?

That was my thought. I had noticed Tweetdeck does pause gifs/videos (or give you the option to only play on mouseover).

This machine is running an Nvidia card... so it should be GPU accelerated.