[GH-ISSUE #205] Idle CPU usage #1042

Open
opened 2026-03-14 13:11:27 +03:00 by kerem · 16 comments
Owner

Originally created by @Icelk on GitHub (May 28, 2023).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/205

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
Originally created by @Icelk on GitHub (May 28, 2023). Original GitHub issue: https://github.com/aome510/spotify-player/issues/205 **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`
Author
Owner

@aome510 commented on GitHub (May 28, 2023):

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?

<!-- gh-comment-id:1566232838 --> @aome510 commented on GitHub (May 28, 2023): 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?
Author
Owner

@Icelk commented on GitHub (May 30, 2023):

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!

<!-- gh-comment-id:1568579977 --> @Icelk commented on GitHub (May 30, 2023): 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!
Author
Owner

@Icelk commented on GitHub (Jun 6, 2023):

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).
flamegraph

<!-- gh-comment-id:1579237441 --> @Icelk commented on GitHub (Jun 6, 2023): 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). ![flamegraph](https://github.com/aome510/spotify-player/assets/62830417/77cc8ab1-26d3-4769-ba0a-57226ad14a5b)
Author
Owner

@aome510 commented on GitHub (Jul 15, 2023):

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.

<!-- gh-comment-id:1636870059 --> @aome510 commented on GitHub (Jul 15, 2023): > 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.
Author
Owner

@Icelk commented on GitHub (Jul 21, 2023):

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?

<!-- gh-comment-id:1644805258 --> @Icelk commented on GitHub (Jul 21, 2023): 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?
Author
Owner

@jacksongoode commented on GitHub (Sep 20, 2023):

Also seeing CPU usage around 7% too.

<!-- gh-comment-id:1728206752 --> @jacksongoode commented on GitHub (Sep 20, 2023): Also seeing CPU usage around 7% too.
Author
Owner

@johnend commented on GitHub (Apr 10, 2024):

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 😞

<!-- gh-comment-id:2048406410 --> @johnend commented on GitHub (Apr 10, 2024): 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:
Author
Owner

@aome510 commented on GitHub (Apr 17, 2024):

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.

<!-- gh-comment-id:2060099328 --> @aome510 commented on GitHub (Apr 17, 2024): 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.
Author
Owner

@lbonvarl commented on GitHub (Jun 6, 2024):

@aome510 great app so far, however, I see also a significant CPU usage with defaults settings on macbook M1. ncspot in comparison is neglibible.

<!-- gh-comment-id:2152544466 --> @lbonvarl commented on GitHub (Jun 6, 2024): @aome510 great app so far, however, I see also a significant CPU usage with defaults settings on macbook M1. ncspot in comparison is neglibible.
Author
Owner

@aome510 commented on GitHub (Jun 6, 2024):

@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.

<!-- gh-comment-id:2152561540 --> @aome510 commented on GitHub (Jun 6, 2024): @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.
Author
Owner

@lbonvarl commented on GitHub (Jun 8, 2024):

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".

Screenshot 2024-06-08 at 12 54 56
Screenshot 2024-06-08 at 12 55 05

I also did "samply record ./spotify_player" from "spotify-player/target/debug" after a cargo build

Screenshot 2024-06-08 at 13 04 39

<!-- gh-comment-id:2155991288 --> @lbonvarl commented on GitHub (Jun 8, 2024): 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". ![Screenshot 2024-06-08 at 12 54 56](https://github.com/aome510/spotify-player/assets/8584443/be420c7c-1c3e-40db-9a43-f0b00f60607e) ![Screenshot 2024-06-08 at 12 55 05](https://github.com/aome510/spotify-player/assets/8584443/e03ce7d4-5d42-4c43-9bd2-6c8920ce75d8) I also did "samply record ./spotify_player" from "spotify-player/target/debug" after a cargo build ![Screenshot 2024-06-08 at 13 04 39](https://github.com/aome510/spotify-player/assets/8584443/7d397d64-3fc1-49c0-8dcc-06191cdaa369)
Author
Owner

@lbonvarl commented on GitHub (Jun 9, 2024):

In comparison, same machine here is the data for ncspot installed via homebrew. CPU usage is when idle at 2-3%
Screenshot 2024-06-09 at 12 52 58
Screenshot 2024-06-09 at 12 53 11
Screenshot 2024-06-09 at 12 56 58

<!-- gh-comment-id:2156442671 --> @lbonvarl commented on GitHub (Jun 9, 2024): In comparison, same machine here is the data for ncspot installed via homebrew. CPU usage is when idle at 2-3% ![Screenshot 2024-06-09 at 12 52 58](https://github.com/aome510/spotify-player/assets/8584443/5c4e4dd3-00bb-423a-9cc4-65615784bfc8) ![Screenshot 2024-06-09 at 12 53 11](https://github.com/aome510/spotify-player/assets/8584443/690c74ff-97a4-4543-996c-9dfa77a7d340) ![Screenshot 2024-06-09 at 12 56 58](https://github.com/aome510/spotify-player/assets/8584443/4a50d0e6-9a73-43d3-8ab4-4ce4b9d7d840)
Author
Owner

@lbonvarl commented on GitHub (Jul 3, 2024):

Hello @aome510, do you need any extra data for this issue ? Let me know.

<!-- gh-comment-id:2205478071 --> @lbonvarl commented on GitHub (Jul 3, 2024): Hello @aome510, do you need any extra data for this issue ? Let me know.
Author
Owner

@atimofeev commented on GitHub (Sep 23, 2024):

Same here. Around 5-7% on idle. Running on 24.05 nixos, pkg from unstable channel.

<!-- gh-comment-id:2368367874 --> @atimofeev commented on GitHub (Sep 23, 2024): Same here. Around 5-7% on idle. Running on 24.05 nixos, pkg from unstable channel.
Author
Owner

@RomanCherkasov commented on GitHub (Jan 8, 2025):

Oh. Same here, but... I have more than 10% of CPU utilization on my M1 Air.
image

spotify_player --version
spotify_player 0.20.4

Installed from brew. ncspot on same laptop 2% - 5%

<!-- gh-comment-id:2578430056 --> @RomanCherkasov commented on GitHub (Jan 8, 2025): Oh. Same here, but... I have more than 10% of CPU utilization on my M1 Air. <img width="461" alt="image" src="https://github.com/user-attachments/assets/4ebf66e9-0017-4f44-a01f-007eb2e2a982" /> ```shell spotify_player --version spotify_player 0.20.4 ``` Installed from brew. ncspot on same laptop 2% - 5%
Author
Owner

@pstumpf commented on GitHub (Dec 4, 2025):

This is very likely related to https://github.com/ratatui/ratatui/issues/1338 .

<!-- gh-comment-id:3610631332 --> @pstumpf commented on GitHub (Dec 4, 2025): This is very likely related to https://github.com/ratatui/ratatui/issues/1338 .
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-player#1042
No description provided.