spicetify / cli

Command-line tool to customize Spotify client. Supports Windows, MacOS, and Linux.
https://spicetify.app
GNU Lesser General Public License v2.1
18.08k stars 717 forks source link

lyrics-plus extreme cpu usage #2877

Closed nxtalex closed 6 months ago

nxtalex commented 6 months ago

🔍 Have you checked Spicetify.app page for your issue?

🔍 Is there already an issue for your problem?

ℹ Environment / Computer Info

- Spotify version: newest
- Spicetify version: newest

📝 Description

pretty simple, lyrics plus uses 20% + cpu , that not good, it happened to a lot of other people as well so not my problem

📸 Screenshots

No response

rxri commented 6 months ago

I think you're talking about Beautiful Lyrics, not lyrics-plus. Beautiful Lyrics is not official extension. It will use your CPU because Spotify has hardware acceleration disabled, and animations needs to be calculated somehow

nxtalex commented 6 months ago

I think you're talking about Beautiful Lyrics, not lyrics-plus. Beautiful Lyrics is not official extension. It will use your CPU because Spotify has hardware acceleration disabled, and animations needs to be calculated somehow

i am using full screen extension, and that extension usees lyrics plus extension, when i take it off it works fine. idk what to say 😕 https://github.com/daksh2k/Spicetify-stuff/issues/151#issuecomment-1975303695

rxri commented 6 months ago

Problem with lyrics-plus is that it cannot use that much, by design. We don't even use requestAnimationFrame or setTimeouts to change UI. Without any debug or performance logs I won't be able to say that it's lyrics-plus' fault since I cannot reproduce this issue. Please keep in mind that stuff like blur etc can take a little of cpu usage because again, spotify doesn't have hardware acceleration

ps. from my testing it's at around 7% when used in Full Screen extension by daksh2k image

ameliorability commented 6 months ago

Same issue, here are screenshots with CPU usage

With lyrics-plus DISABLED: image

With lyrics-plus ENABLED but not being used: image

With lyrics-plus ENABLED and being used: image

But thank you rxri and other wonderful developers for this wonderful extension :)

rxri commented 6 months ago

Like I said in my second message, I need performance logs or anything useful, since as mentioned in my previous comment, it's at around ~7% for me, so I cannot "debug" it. I'm sorry. I recommend trying when you don't have themes and extensions installed, just lyrics-plus

SKDemon820 commented 6 months ago

Hey, I don't have logs rn but just wanted to report that I also have the same issue. The CPU usage by Spotify Helper jumps from 15% (open) or <1% (minimized) to >200% when the lyrics-plus panel is open (it's fine when it's closed), I attached a video showing it (I have other stuff installed in the video but I later tested with all extensions and themes deleted and it still occured). I updated Spotify, Spicetify, and Lyrics-plus to the latest last night, and noticed the issue today when I minimized Spotify with the panel opened and my laptop's entire keyboard became significantly warm over about an hour.

I don't really have much experience with reporting this kind of stuff, if possible what exactly can I save and submit to help debug it?

https://github.com/spicetify/spicetify-cli/assets/62918850/7c8b39e9-801f-41ee-b170-99fb4b00cdce

InsanityPrelude commented 6 months ago

Well, this is frustrating. I've managed to acquire Performance Data showing this issue using DevTools, but I can't actually save the trace from it. There's a bug affecting DevTools right now relating to DevTools not being exempt from File Access permissions, so it's not possible for me to save it, and it simply returns "Failed to save timeline: The request is not allowed by the user agent or the platform in the current context. (NotAllowedError)" unfortunately.

In the interim, here's the screenshot I was able to produce. In it, I started the recording while viewing Spotify in Desktop mode looking at the Marketplace. At 3 seconds I switched into "Lyrics" view, and then I switched out at 10 seconds and alternated in and out every 5 seconds afterwards. There's clearly something going on, but unfortunately I don't think I know enough to figure it out. I'm not even smart enough to figure out whether some unhinged maniac actually named all these functions by pouring out a can of alphabet soup or if I'm just not loading a source mapping file correctly.

image

Zooming in, the best I can figure out is that the function designated "L" is being called in a loop thousands of times continuously.

image

I'm going to see if I can do anything about the File Access Permissions for DevTools so I can just upload a performance trace when the problem is occurring.

samuelawachie commented 6 months ago

This is definitely a problem and it's affecting me too (on Linux Zorin; latest versions of both Spotify (apt) and Spicetify). CPU usage spikes by 30% when you open the lyrics page or using any extensions that depend on it (like FullScreen by dash2k) You needn't even play any song. Just opening/clicking the lyrics button to open the lyrics page causes it. And of course, all the attendant issues with temperature, fans spinning, performance/lagging, and an exasperated user. /: Need a fix, please.

rxri commented 6 months ago

@InsanityPrelude use remote debugging port: Run spotify with: --remote-debugging-port=9222, then in your browser chrome://inspect or edge://inspect, then inspect Spotify, go to Performance tab and do whatever you did to reproduce it and save performance report

I still cannot reproduce it. Unless my PC is so fast that ~13% of cpu usage is the ~30% you're getting

Spotify for Windows (32 bit)
1.2.32.997.g4c6498b6
Spicetify vDev
xpui_2024-02-23_1708709925614_4c6498b
cef_121.3.15+g4d3b0b4+chromium-121.0.6167.184
Runtime: Chrome
ohitstom commented 6 months ago

i think some more information from these guys would be helpful, especifically their full spotify version info as well as their system architecture (amd, nvidia, etc)

InsanityPrelude commented 6 months ago

That's a reasonable thought. It might be something unusual, like it only affects AMD processors, Windows 11, a specific version of Spotify, etc. Here's my info. Perhaps if a couple of others experiencing it can share, we can narrow down what distinguishes us from rxri's build, which isn't experiencing this problem.

Spotify for Windows (64 bit) 1.2.32.997.g4c6498b6 Spicetify v2.33.2 Theme: marketplace Extensions: fullScreenWrapper.js Custom apps: marketplace, lyrics-plus xpui_2024-02-23_1708709925614_4c6498b cef_121.3.15+g4d3b0b4+chromium-121.0.6167.184 Runtime: Alloy

OS Name: Microsoft Windows 11 Home OS Version: 10.0.22621 N/A Build 22621 System Model: X670 AORUS ELITE AX Processor: AMD Ryzen 7 7800 X3D 8-Core Processor

rxri commented 6 months ago

You can find my build here: https://pcpartpicker.com/list/gnrTDZ (ignore the RX 570). I'm also on Windows 11 Insier Preview Dev Build (23620.1000)

ohitstom commented 6 months ago

Runtime: Alloy

could you try forcing your spotify to run with chromium and not alloy using the flag --enable-chrome-runtime

rxri commented 6 months ago

Runtime: Alloy

could you try forcing your spotify to run with chromium and not alloy using the flag --enable-chrome-runtime

I did not have this issue on Alloy runtime either. Chrome runtime just has more APIs enabled

InsanityPrelude commented 6 months ago

I've just rebooted Spotify with that argument. The same issue still occurs for me.

It's easy to tell even without devtools, because my computer runs silently until I open "Lyrics" and then the CPU fan starts up and takes off. Can't seem to access DevTools in this mode though. Here's the output of Version

Spotify for Windows (64 bit) 1.2.32.997.g4c6498b6 Spicetify v2.33.2 Theme: marketplace Extensions: fullScreenWrapper.js Custom apps: marketplace, lyrics-plus

ohitstom commented 6 months ago

I've just rebooted Spotify with that argument. The same issue still occurs for me.

It's easy to tell even without devtools, because my computer runs silently until I open "Lyrics" and then the CPU fan starts up and takes off. Can't seem to access DevTools in this mode though.

are you using integrated graphics? (the 3d part of your cpu), the other people having issues here seem to mention laptops alot which often use integrated graphics

rxri commented 6 months ago

then in your browser chrome://inspect or edge://inspect, then inspect Spotify, go to Performance tab and do whatever you did to reproduce it and save performance report

What I meant in "inspect Spotify" is that you will see in the tab you opened, Spotify page, then under it "Inspect" button

InsanityPrelude commented 6 months ago

I've just rebooted Spotify with that argument. The same issue still occurs for me. It's easy to tell even without devtools, because my computer runs silently until I open "Lyrics" and then the CPU fan starts up and takes off. Can't seem to access DevTools in this mode though.

are you using integrated graphics? (the 3d part of your cpu), the other people having issues here seem to mention laptops alot which often use integrated graphics

I'm not, I'm using an RTX 2080. I just checked the GPU for the process and it's not using the iGPU as far as I can tell.

I'll try rxri's suggestion now.

ohitstom commented 6 months ago

can confirm the issue on my device, ~5% idle, jumps to 20-30% on the lyrics page

rxri commented 6 months ago

image Is the rasterization hardware accelerated for you both?

InsanityPrelude commented 6 months ago

image It It does appear to be, yes.

ohitstom commented 6 months ago

Trace-20240307T172643.zip here is my trace, based on the trace i dont believe its a gpu issue but here is my rasterization stuff anyways: image

InsanityPrelude commented 6 months ago

Trace-20240307T122824.zip

Hah, funny enough I was just able to also retrieve a Trace log. I've attached it here as well.

Edit: I feel dumb, zipping it's probably a good idea >_>

ohitstom commented 6 months ago

image it looks like every 0.1ms its removing and re-adding a child over and over and over and over again? image

rxri commented 6 months ago

The most funny thing is that it's from React scheduler code

ohitstom commented 6 months ago

i could be wrong but i believe this to be the culprit (at least partly)? image

i just took another performance sample with the page already open sitting there doing nothing (Not even playing a song) yet this function keeps being called

these useeffects keep getting called recursively too, in fact almost every recursive action is coming from this component: image (window size specifically)

this can kind of be seen visually here:

https://github.com/spicetify/spicetify-cli/assets/22730962/289a1d6c-139a-4a03-b103-7dd2aa16a734

rxri commented 6 months ago

holy shit... i know why this is happening