Skip to content
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

Issue: High CPU usage #27

Open
Mishasama opened this issue Aug 24, 2024 · 10 comments
Open

Issue: High CPU usage #27

Mishasama opened this issue Aug 24, 2024 · 10 comments
Assignees
Labels
bug this item causes errors that make the project unusable enhancement this item makes the project better in some way

Comments

@Mishasama
Copy link

Mishasama commented Aug 24, 2024

Describe the bug

When opening and viewing the settings page, the CPU and memory usage is unusually high.

To Reproduce

  1. Open the settings
  2. See error

Expected behavior

A settings page shouldn't have such a high CPU usage, is something caught in a dead loop?

Screenshots

image

Extension Information

  • Version: 5.33.4.6/7
  • Source: store & GitHub
  • Browser: chrome & edge
  • Operating System: Windows

Additional comments

CPU usage drops to single digits when placing the page in the background without displaying it, is this caused by any active element rendering over and over again?

Also, when using TTVT, all Twitch tabs' CPU usage goes high.

From Ephellon

  • Seems to be caused by events being fired less than 100ms
@Mishasama Mishasama added bug this item causes errors that make the project unusable enhancement this item makes the project better in some way labels Aug 24, 2024
@Ephellon
Copy link
Owner

I can get spikes up to 54.6%. Please provide detailed reproduction steps. If you simply just opened the Settings page, would you be ok with detailing your available RAM (see navigator.deviceMemory)?

  1. Open Settings
  2. Right click and select Inspect
  3. Select the Console tab
  4. Type navigator.deviceMemory
  5. Let me know what number shows up. Mine for example, is 8, meaning I have at least 8GB available in the browser

@Mishasama
Copy link
Author

Mishasama commented Aug 27, 2024

8
image
image

@Ephellon
Copy link
Owner

Thank you. I'll continue the stress tests to see what module is causing hiccups

@Ephellon
Copy link
Owner

Ephellon commented Aug 31, 2024

Found issue(s), some events were set to fire at 10ms. Changed to 100ms, and CPU usage is <1% 5mins later. Max spike 90% while typing and moving mouse simultaneously.

image

@Ephellon
Copy link
Owner

@Mishasama please try v5.33.4.8-beta to see if the Settings page has improvements on your system 😊

ttv-tools.v5.33.4.8-beta.zip

@Ephellon Ephellon changed the title Issue: High CPU usage when opening the settings page Issue: High CPU usage Aug 31, 2024
@Mishasama
Copy link
Author

Max spike 90% while typing and moving mouse simultaneously.

Indeed, this happens once these actions are active, even with the .8 version.
Are there any features that use these determinations?

And still get high usage on the stream page.


Maybe... try asking ChatGPT to help with debugging?

There are a few clues in my observations:

  1. Are there concentrated polling behaviors? For example, different functions execute in parallel or for a short period. How about 1 second?
  2. Are there any incorrect nested loop conditions? This is commonly referred to as an infinite loop.
  3. Is there real-time animation rendering with high resource consumption? Such as the high frame rate rainbow animation seen in "Buy When Available."

I found another issue.
Recover Frames
It will constantly pause and resume playback for short periods.
When we need this function, it means that our network or hardware has a problem that cannot be quickly fixed.

@Ephellon
Copy link
Owner

Ephellon commented Aug 31, 2024

Stream page, yes, I want to start on the smaller, more manageable Setting spage first to see what can be changed.


  1. 1 second won't work, there are dynamic changes being made
  2. Only the infinite loops needed are present. The page would freeze if there were any unaccounted for...
  3. There's always real-time animation playing... requestAnimationFrame. The rainbow animation uses the GPU

Recover Frames → Please elaborate in a new issue

@Mishasama
Copy link
Author

Tabs consume about twice as much CPU when displayed in the foreground as when running in the background, so I suspect it's a rendering-related issue. Maybe you can reduce consumption by lowering the frame rate; there's a power-saving mode option in Chrome for lowering the frame rate globally, so maybe that helps somewhat?
But it's also possible that the browser is limiting the behavior of the tabs in the background, which appears to be decreasingly usage...

@Ephellon
Copy link
Owner

Those settings are managed by Chrome on the Application scale—I have little to no control over that. The best I can do is change how the extension works...

@Mishasama
Copy link
Author

image
Bad news, still very high.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug this item causes errors that make the project unusable enhancement this item makes the project better in some way
Projects
None yet
Development

No branches or pull requests

2 participants