-
Notifications
You must be signed in to change notification settings - Fork 250
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
High CPU usage in Cordova iOS webview #464
Comments
@DnMllr Do you think this is due the fact that we're sending empty messages via |
Looking into this. |
@michaelobriena Thank you 👍 .. I'm a little curious myself, so I'm playing around in engine code a bit. It seems like with 600 nodes, SizeSystem.update() and TransformSystem.update() will each loop through all 600 nodes every frame checking if they have changed. I wonder if it would be better to have the node message the systems when they have changed rather than checking each one of them constantly? Just my first thought. |
I was thinking that too. The idea was that the traversal is so cheap and since nothing has changed we just do no math. 0.3 also did the full traversal but also did all of the math regardless of changes so I think there is something a little funkier at play. Running this in the browser has really great performance (essentially totally idle) so later today / this weekend I will try and build with cordova to see if that is the issue. Just need to remove Meteor from the equation to make sure we can pinpoint the issue. |
Okay I removed Meteor from the equation. The new master branch of that repo is just plain Cordova with Famous Engine. Ya Ive seen great performance on desktop too. It's just when it's in a webview for some reason? |
Also going to test cordova webview vs the standard UIWebView. |
do you know if this is the case for 0.6 or 0.5 famous? |
I'm not. I haven't tested it with those versions. |
Having issues with cordova, will report back. |
ok. I'm using Cordova version 5.0.0 btw. Random discovery: |
It looks like Transform.prototype.calculate() (fromNode()) might be the most expensive method. |
This makes me a little concerned, can you be a little more specific about
On Thursday, August 6, 2015, Andrew Reedy notifications@github.com wrote:
|
@jd-carroll I can not say if this is an issue for all Cordova apps. I can only show that it's an issue with this simple case. The CPU usage increases with the number of nodes so for my iPhone 5s the CPU hits 100% at about 450 empty inanimate nodes. |
@jd-carroll I agree, this is concerning to me. The thing I can say is that the runtime of our transform math will always be less expensive than it is in 0.3 so I am assuming there is something else at play. |
Can you try testing the same app from Safari browser on mobile to confirm On Sunday, August 9, 2015, michaelobriena notifications@github.com wrote:
|
@jd-carroll Well thats not entirely true; UIWebView uses a different JS engine than Safari iOS and I'm not sure if I can do the same XCode CPU profile on a mobile website |
The issue has to do with TransformSystem.update. We aren't gating correctly. There are some corner cases we are working through but your example was running at 3% on desktop and 30-40% on mobile safari / cordova. |
@michaelobriena yea this is what I was thinking as well. It should only run |
@andrewreedy correct. That said, this fix doesn't solve everything. We are seeing that even a blank request animation frame is running at around 10% CPU usage on mobile safari. |
@michaelobriena What edge cases wouldn be missed if Transform.update did On Monday, August 10, 2015, michaelobriena notifications@github.com wrote:
|
Nothing would move for that frame. |
@michaelobriena Were you able to test this using the WKWebView? While switching web views doesn't necessarily solve the problem, it does seem to dramatically help. |
@michaelobriena Any updates/progress on this? |
I'm curious about this too, as I'm having bad perf in Chrome on Nexus 5, and I can't tell why. The scene graph is not complex, but it's just slow (the framerate). |
@andrewreedy can you simulate the process using crosswalk instead? Let me know |
@lxndralbert I'm currently only focused on iOS |
Are we still experiencing this issue? I'm starting a project and would like to know if this still persists or if someone has a fix. Thank you! |
My new release of When no updates exist, 0% CPU is used, and no rAF loop exists at all. Up next will be providers (for example something like a |
sounds great!! |
I was wondering why my iOS Famous app was using 100% CPU so I made an empty test app to see at what point the CPU spike started. It seems even with empty nodes which aren't animating the CPU spikes pretty quickly. Any thoughts on whats causing this?
Famous version:
0.7.1
Other Note:
The app in Famous 0.3.0 used about 5% CPU
Test Repo:
https://github.com/andrewreedy/engine-meteor-cordova-test
The text was updated successfully, but these errors were encountered: