question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] checkIfDefined is doing nothing but wasting CPU

See original GitHub issue

Describe the bug

The current implementation can and is endlessly looping so long the elements are not defined which in some cases won’t be and due to the logic used in this function it will somehow use noticeable (on low-medium spec CPU) CPU Utilization.

e.g. https://mail.google.com

Steps to reproduce

  • Go to mail.google.com
  • Open performance tab in Dev tools
  • Get a fresh performance ctrl +e after the page has been fully loaded.
  • See that even that checkIfDefined is still being called in a animationFrame alongside checkForUpdate(expected)

Expected behavior

Not using CPU or some other implementation to prevent this, not even sure what :defined has to do with Shadow DOM’s.

Actual behavior

It’s using CPU utilization even in idle when not needed

System Information:

  • OS: Windows 10
  • Browser: Vivaldi(3.4.2066.76)
  • Dark Reader version: 4.9.21

Additional context

More info about this https://github.com/darkreader/darkreader/issues/3811#issuecomment-712695274

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ddnexuscommented, Nov 1, 2020

Lot of work! Thank you!

0reactions
Gustedcommented, Nov 1, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

C Main Loop without 100% cpu - Stack Overflow
If you are doing something useful (i.e. processing a lot of data), then 100% cpu load just means that the processor is used...
Read more >
[Solved] System Interrupts High CPU Usage on Windows 10
If you find System interrupts keep taking up over 20% of CPU usage, it means there's something error with your hardware or the...
Read more >
How to Fix High CPU Usage in Windows - AVG
Long-term high CPU usage (say 90-100%) can cause computer freezes & crashes. Find the cause and fix high CPU usage on Windows today....
Read more >
How to Fix High CPU Usage - Intel
Find out all the reasons why your PC displays high CPU usage. Our step-by-step guide will show you how to fix your CPU...
Read more >
Troubleshooting High CPU Utilization - Cisco
In the stacked switch, the CPU utilization is measured on the master switch only. If the CPU is busy 5% of the time...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found