spotify-player
spotify-player copied to clipboard
Idle CPU usage
Describe the bug
When spotify_player
is not playing (only tested with the integrated streaming on), it still uses ~7% of 1 CPU core (on a modern Ryzen).
To Reproduce Open the app.
Expected behavior < 1%
Log and backtrace
I the default config, though suspect this has something to do with image
.
Environment
- OS: Arch
- Application version: 0.14.0
- Application features:
-F notify,image,lyric-finder,pulseaudio-backend,streaming,media-control --no-default-features
FYI, it was ~0.7%
of 1 CPU core for my M1 Macbook Air. It would be helpful if you can provide a video/pictures for a demonstration.
Why do you think that 7%
is not a good number but <1%
? Do you have any baselines for comparison?
I'll try to compile with other feature sets, to see if I can narrow it down.
Compared to spotifyd, which uses 0-1% while idle. Playback should consume more cpu than being idle, but for now playback only uses ~2%, which is great!
Looks to be an issue even with all features disabled. I'll include the flamegraph. How often is the UI updated? IIRC, spotify-tui heavily throttled updates when the window wasn't focused (I don't know how to detect that in terminals).
How often is the UI updated
It's determined by app_refresh_duration_in_ms
config option (default to be every 30ms
). You can increase the value if the default one feels consuming too much CPU.
Thanks! Would it be possible to make that refresh interval 500ms
when I'm not inputting anything into spotify_player
, but 32ms
when I interact?
Also seeing CPU usage around 7% too.
I'm seeing high CPU usage on my macbookpro11,3 under EndeavourOS usually in the mid 30% range. This is true while playing and running via cargo run --no-default-features
. Generally a great alternative to spt
but that's not really usable for me :disappointed:
I've been neglecting the app's performance for a while as its CPU usage is relatively low for me. top
also gives me around 7%
w.r.t one core. The previous tool I used reports CPU usage w.r.t all cores, so the number is 1/8 smaller.
Now, as I'm more interested in performance optimization, I'll come back to this issue and try something.
@aome510 great app so far, however, I see also a significant CPU usage with defaults settings on macbook M1. ncspot in comparison is neglibible.
@lbonvarl thanks for reporting. Can you share the number on your machines, e.g what are CPU usages of spotify_player
and ncspot
? It can provide a good baseline for me to optimize.
That said, kinda busy lately, so I didn't have the chance to pick up this yet.
Hello @aome510, I am on Macbook Pro 13in, 2020 M1 16GB Sonoma 14.5, using current iterm2 3.5 under zsh. spotify_player sitting idle not playing is at 35% CPU on task manager with defaults setting. I installed via "cargo install spotify_player --features lyric-finder".
I also did "samply record ./spotify_player" from "spotify-player/target/debug" after a cargo build
In comparison, same machine here is the data for ncspot installed via homebrew. CPU usage is when idle at 2-3%
Hello @aome510, do you need any extra data for this issue ? Let me know.