-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Bug: Excessive cpu usage of the page when react-devtools is active #17935
Comments
I can take a look on this :) |
@myshov Have you tried it on another machine? It works fine in my Chrome |
@ideffix I don't have another machine. But I posted that issue in local chat and at least one more person confirmed the issue |
@myshov I tried to replicate this issue, however it worked perfectly fine in both chrome/firefox devtools, on Mac laptop. |
@M-Izadmehr Hmm... it is really strange. I have checked once again with fresh cra project in Chrome 80 and the problem is still there |
I can confirm it's reproducible, running Chrome 80.0.3987.87, React Dev Tools 4.4.0 & React 16.12.0 on Debian Linux, bundled with Parcel. Also happened to my coworker while building our Storybook with Webpack on Mac. Here's a bare reproduce minimum that consistently worked across several machines. |
@mkrl Interesting, I cloned your repository it worked fine for me too, it might be a chrome bug on ubuntu, can you also check it with firefox devtools (it is basically the same code base just built for firefox), if it exists there too it means that it is probably related to react-devtools. |
@M-Izadmehr just checked, I was able to achieve a similar behavior in Firefox 72.0. Firefox paint flashing doesn't indicate the entire page being updated in a way Chrome dev tools did, however the CPU usage did skyrocket to 100%. |
can i take this issue? |
@naima-shk hi! As far as I know no one works on this issue so you can take it |
I tested this on Firefox:68.5.0esr and React Dev Tools:4.4.0-f749045a5 and can reproduce this issue. But I tested this again after building @myshov can you to test this by building the extension? |
I did some research and results are as follow CPU: AMD Ryzen 5 3600 6-Core Processor (12 CPU’s)
My pattern to reproduce issue looks like this:
Tests using the Firefox browser reveal a clear increase in CPU utilization after the component status changes. Chrome browser didn’t manifest this behavior what is confirm attached "CPU History". |
Happy to take PRs! We're not actively looking into this ourselves right now. |
File: It's looks like the problem is in Google chrome handles this quite well, I see problems on firefox under ubuntu (I didn't have the opportunity to check on windows for now). |
Oh wow. So essentially
I think it's just a buggy condition. The idea is that earliest expiration would get overwritten here. I think what the code should do is not call |
Oh, I see. I'll try to refactor it a little bit but without engaging to refactor other functions. Maybe just reversed conditions will be more readable in this situation. |
When option "Highlight updates when components render" is activated the whole page repaints in rapid succession after the components state has been changed. It causes 100% CPU usage by the browser and unpleasant DX due low fps.
React version: 16.12.0
DevTools version 4.4.0-f749045a5
The sequance of actions is important:
The code example (to trigger the issue: 1) check the option "Highlight updates when components render" and 2) click on the button:
The current behavior
Excessive cpu usage of the page
The expected behavior
Normal cpu usage of the page
The text was updated successfully, but these errors were encountered: