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

New React.Perf eats a lot of CPU. #6983

Closed
niba opened this issue Jun 7, 2016 · 11 comments
Closed

New React.Perf eats a lot of CPU. #6983

niba opened this issue Jun 7, 2016 · 11 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@niba
Copy link

niba commented Jun 7, 2016

After migration to React 15.1.0 I noticed that my application is running slower than usual. Quick debug with Chrome profiler shows that method purgeUnmountedComponents from ReactComponentTreeDevtool eats around 30% of my application time. On every mouse move or click method iterates over huge amount of elements. I don't know if that behaviour is desirable.

reactperfcpu

@gaearon
Copy link
Collaborator

gaearon commented Jun 7, 2016

Hi! Could you try building React from master and giving it another try? I know @spicyj optimized some of this in #6770 but it hasn't been released yet.

@gaearon gaearon added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Jun 8, 2016
@gaearon
Copy link
Collaborator

gaearon commented Jun 8, 2016

For now I’ll mark as unconfirmed, but I’m happy to look into it if you provide an example app that reproduces this.

@niba
Copy link
Author

niba commented Jun 9, 2016

I have just checked it with the latest version from master and it is better.

reactmasterperfcpu

reactmasterperf2

Stil it eats around 15-20% but maybe it is connected with my shouldComponentUpdates. I need to analyze it more closely.

@gabrielenosso
Copy link

I have the same problem.
I didn't try with the "master" though.

@sophiebits
Copy link
Collaborator

As far as I can tell your last two screenshots don't show anything from the perf tools? The function names there all just look like normal batching/update code.

@niba
Copy link
Author

niba commented Jun 10, 2016

@gaearon Thanks for help

@spicyj I know that you closed it but I observed one more thing regarding this topic.

I'm developing a map based web app where user mostly just browse and move around on the map. These actions fire a lot of map events like zoomIn, zoomOut, mapMove. Here is a screenshot from profiler after one of those session when user just browses map and doesn't use heavily react part of application. React@master(after 15.1.0) eats here about ~9% of my CPU

perflast2

and now the similar session with [email protected], here we have ~3-5%

oldreactlast

as you can see the time is much bigger in the latest version. I wanted to let you know about this

@gaearon
Copy link
Collaborator

gaearon commented Jun 10, 2016

But that's unrelated to ReactPerf, isn't it?
Are you measuring production builds?

@jacehensley-wf
Copy link

I am also seeing this using react.js on 15.1.0. It seems to not be an issue with react.min.js

I built react.js with "master" and the issue seems to go away.

@gaearon
Copy link
Collaborator

gaearon commented Jun 11, 2016

I built react.js with "master" and the issue seems to go away.

👍

Then it’s fixed in master and the fix will be out in the next release.

@niba
Copy link
Author

niba commented Jun 15, 2016

@gaearon true, it is unrelated to ReactPerf, sorry for making mess, i'm beginner in open source and I need to learn a lot. In production mode times are the same so I think that the debug mode is a little heavier in the latest version.
Thanks for help!

@gaearon
Copy link
Collaborator

gaearon commented Jun 15, 2016

Please feel free to investigate the difference further. It might very well be that there is low hanging fruit for optimization of DEV in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

5 participants