Skip to content

Performance issue: Too high CPU usage #507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
systemoperator opened this issue May 7, 2023 · 11 comments
Closed
1 task done

Performance issue: Too high CPU usage #507

systemoperator opened this issue May 7, 2023 · 11 comments
Labels
bug Something isn't working deployed This issue has been fixed/implmented and has been released

Comments

@systemoperator
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When starting Spotube without playing music, it permanently consumes 80 to 86% CPU.
When playing music, it permanently consumes 80 to 107% CPU.

Expected Behavior

Much less CPU usage.

Steps to reproduce

  1. open app.
  2. optionally, play music.

Operating System

Linux Debian 11, 64-bit, Mate desktop

Spotube version

2.7.1

Installation source

Flathub (Flatpak)

Additional information

No response

@systemoperator systemoperator added the bug Something isn't working label May 7, 2023
@karniv00l
Copy link
Contributor

karniv00l commented May 8, 2023

Just my 2 cents - it clearly re-renders when it shouldn't, there's almost nothing in the UI, and still it uses a substantial amount of CPU and GPU. Should be both 0.0 when idle.

Screenshot 2023-05-08 at 14 04 45

@megamorf
Copy link

megamorf commented Jun 23, 2023

I can confirm this is also affecting me - M1 MacBook Pro. Energy consumption of the program far exceeds everything else on the system (2nd column = energy demand):
image

spotube.log

@KRTirtho
Copy link
Owner

That's been fixed already. Check out the nightly release?

@karniv00l
Copy link
Contributor

karniv00l commented Jul 3, 2023

@KRTirtho still an issue on e560ade

I've removed all the widgets in the player_controls.dart and narrowed it down to this line: https://github.com/KRTirtho/spotube/blob/master/lib/components/player/player_controls.dart#L51

but, that's without anything rendered, so there's still an issue with the current widget tree

@RaptaG
Copy link
Contributor

RaptaG commented Jul 3, 2023

Using 3.0.0 from Flathub on Fedora Kinoite 38, I cannot reproduce such a high CPU usage

@KRTirtho
Copy link
Owner

KRTirtho commented Jul 4, 2023

Even RepaintBoundary doesn't fix it 🤔
But bufferingStream is a empty stream. It's there for compatibility reasons only
https://github.com/KRTirtho/spotube/blob/master/lib/services/audio_player/audio_players_streams_mixin.dart#L92-L104

@dimitris-personal
Copy link

dimitris-personal commented Jul 12, 2023

I can reproduce here, v3.0.0 on Fedora 38/GNOME/Wayland/flathub.

Without any song playing:

Screenshot from 2023-07-12 08-41-42

@Playit3110
Copy link

Playit3110 commented Jul 30, 2023

Under Win10 with Spotube v3.0.0 it is the same
grafik

I think its some memory leak as well. Dont know if you keep all data after playing a song or if it is removed from ram and maybe stored in storage, but this is ridiculous.

Additional info

---------- ERROR ----------
OAuth2 credentials have expired and can't be refreshed.
------- STACK TRACE -------
#0      Client.send (package:oauth2/src/client.dart:109)
#1      BaseClient._sendUnstreamed (package:http/src/base_client.dart:93)
#2      BaseClient.get (package:http/src/base_client.dart:27)
#3      SpotifyApiBase._getImpl.<anonymous closure> (package:spotify/src/spotify_base.dart:173)
<asynchronous suspension>
#4      SpotifyApiBase._requestWrapper (package:spotify/src/spotify_base.dart:206)
<asynchronous suspension>
#5      SpotifyApiBase._getImpl (package:spotify/src/spotify_base.dart:172)
<asynchronous suspension>
#6      Pages.getPage (package:spotify/src/endpoints/endpoint_paging.dart:236)
<asynchronous suspension>

was in my log and every 3 seconds it happend again.

@karniv00l
Copy link
Contributor

karniv00l commented Aug 1, 2023

Possible fix in #606, not sure about the memory leak, though may be connected to usage of RepaintBoundry (https://github.com/KRTirtho/spotube/pull/606/files#r1280247423)

@KRTirtho
Copy link
Owner

KRTirtho commented Aug 2, 2023

I think we can safely say it's fixed now. Thanks to @karniv00l 🚀

@KRTirtho
Copy link
Owner

KRTirtho commented Aug 5, 2023

The fix is now available on v3.0.1
Please check if it works

@KRTirtho KRTirtho added the deployed This issue has been fixed/implmented and has been released label Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working deployed This issue has been fixed/implmented and has been released
Projects
None yet
Development

No branches or pull requests

7 participants