Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Discussion: Flipper painfully slow on Mac Big Sur #2173

Closed
vomchik opened this issue Apr 9, 2021 · 18 comments
Closed

Discussion: Flipper painfully slow on Mac Big Sur #2173

vomchik opened this issue Apr 9, 2021 · 18 comments
Labels
bug Something isn't working

Comments

@vomchik
Copy link

vomchik commented Apr 9, 2021

After the release of the 80+ version, Flipper now very slow and consumes a lot of CPU time. UI is very laggy. Sometimes all animation effect has dropped frames.

Do you know about this problem?

CleanShot.2021-04-09.at.15.34.07.mp4

CleanShot 2021-04-09 at 15 36 04@2x
CleanShot 2021-04-09 at 15 41 39@2x

@a-sane
Copy link

a-sane commented Apr 11, 2021

I have the same problem
Flipper 0.84.0:

image

@rufat
Copy link

rufat commented Apr 11, 2021

Same problem. So laggy! (version 0.84.0)

@mweststrate
Copy link
Contributor

Hi folks, I tried reproducing this with the OSS build on several devices, but failed to get similar bad performance. Please provide some more details: what kind of device (OS + simulator / emulator) are you connected to, what plugins are enabled, and which one is currently active. Which OS are you on etc.

Providing a performance profile would be very helpful, it can be created by using View > Toggle Developer Tools > Performance Tab, and then press the record button, after it started record 10 to 20 seconds, stop the recording and use the save profile button to export it.

@rufat
Copy link

rufat commented Apr 12, 2021

Hi folks, I tried reproducing this with the OSS build on several devices, but failed to get similar bad performance. Please provide some more details: what kind of device (OS + simulator / emulator) are you connected to, what plugins are enabled, and which one is currently active. Which OS are you on etc.

Providing a performance profile would be very helpful, it can be created by using View > Toggle Developer Tools > Performance Tab, and then press the record button, after it started record 10 to 20 seconds, stop the recording and use the save profile button to export it.

I'm connecting to iPhone 11 (iOS 14.4) Simulator with MacBook Pro (Mac OS 11.2.3). Profiler JSON: https://gist.github.com/rufat/cf4ce078b07ec9fe7c7218d3b5aa9245

image

@mweststrate
Copy link
Contributor

mweststrate commented Apr 12, 2021

It looks that the interaction with the XCode is really really slow. Could you run the following command just to verify XCode itself is responsive?

time xcode-select -p

From what I can see however, this seems to be mostly caused by Electron on Big Sur, every time we spawn a process it blocks for 300(!) ms seconds inside the standard library. It probably relates to: electron/electron#26143 / libuv/libuv#3050 (comment)
Screenshot 2021-04-12 at 12 46 49

@passy
Copy link
Member

passy commented Apr 12, 2021

Phew, that's horrible. We don't have "official support" for Big Sur yet, as in we don't run it on Big Sur internally and have no way of testing it. If it comes down to individual command invocations, we could probably cache them more. For Xcode mismatches, that's likely something running once per session would suffice.

@mweststrate
Copy link
Contributor

This specific example we could probably cache. But many commands we can't. For example querying devices happens every few seconds, we could cache 2/3 of the commands, which would make things slightly better, but that third command has to run fresh and will block the interface 400ms which will be still very noticable every few secs.

And we have many more things that spawn processes regularly: doctor checks, starting / stopping listening to logs, certificate exchange, port forwarding, etc etc. In the attached profile Flipper is blocked for 12 full seconds when starting, due to all the commands we spawn that all get penalised 😅.

I'll try to put up a diff next week (unless someone else volunteers) to at least cache some of the xcode commands, but I don't think it is gonna solve the problem.

From what I can see it should have been fixed in Electron 12.0.0, but later the change was reverted. It is unclear to me whether the reverted change has been released as well and in what version. It'd be awesome if someone on Big Sur could clone the repo, run it from source (yarn install && yarn start in desktop folder) and check if the issue still occurs. If it does, I'm very curious if downgrading Electron to 12.0.0 (or even before) avoids the problem. Help would be much appreciated!

@rufat
Copy link

rufat commented Apr 12, 2021

It looks that the interaction with the XCode is really really slow. Could you run the following command just to verify XCode itself is responsive?

time xcode-select -p

From what I can see however, this seems to be mostly caused by Electron on Big Sur, every time we spawn a process it blocks for 300(!) ms seconds inside the standard library. It probably relates to: electron/electron#26143 / libuv/libuv#3050 (comment)
Screenshot 2021-04-12 at 12 46 49

Output is: xcode-select -p 0.00s user 0.00s system 66% cpu 0.010 total

I did try the codesign --remove-signature /Applications/Flipper.app/Contents/Frameworks/Flipper\ Helper\ \(Renderer\).app and no luck.

The interesting part is it was working smoothly with the previous versions.

@rufat
Copy link

rufat commented Apr 12, 2021

I downgraded to 0.79.0 and it works smoothly again. I will use it temporarily.

@mweststrate
Copy link
Contributor

Looks like the Electron 12 update shipped in 0.82. Using 0.81 should be the highest one on Electron 11

@mweststrate mweststrate changed the title Discussion: Flipper app performance degradation Discussion: Flipper painfully slow on Mac Big Sur Apr 12, 2021
@mweststrate mweststrate added the bug Something isn't working label Apr 12, 2021
facebook-github-bot pushed a commit that referenced this issue Apr 13, 2021
Summary:
Downgrade electron to 11.2.3 to work-around performance problems described in #2173.

Changelog: Electron downgraded to v11.2.3 to work-around performance issues on MacOS Big Sur

Reviewed By: passy

Differential Revision: D27732746

fbshipit-source-id: cec187f47ac5b734c33f3e6eecc5cf0b03d76c1a
@vomchik
Copy link
Author

vomchik commented Apr 15, 2021

@nikoant Thanks a lot for the quick fix. Now it works much better, but not ideal 😅

@rufat
Copy link

rufat commented Apr 15, 2021

Thanks, everyone. It works flawlessly.

@jonathanroze
Copy link

@vomchik Check in Flipper settings if you correctly set 'Idb' path. After fixing that point, Flipper runs well on my computer !

@tkserver
Copy link

tkserver commented May 6, 2021

@vomchik how or what do you have to do to "correctly set ldb path"?

@jonathanroze
Copy link

jonathanroze commented May 6, 2021

You need to install idb

brew tap facebook/fb
brew install idb-companion
pip3 install fb-idb

Source: https://github.com/facebook/idb

When IDB is installed, launch Flipper and click on File -> Preferences

Toggle on iOS Developer and Enable Physical iOS devices

And you can set your IDB Path in IDB binary location.

In my case Idb path is /Library/Frameworks/Python.framework/Versions/3.9/bin/idb

And if you don't know the path you can execute that cmd which idb

Hope my instructions will help you :)

@rdewolff
Copy link

rdewolff commented May 16, 2021

@vomchik Check in Flipper settings if you correctly set 'Idb' path. After fixing that point, Flipper runs well on my computer !

Thanks @vomchik that did the trick. Had the same issue on the latest version (0.90.2 (50.0.0)). Seems there is an issue when the idb location is not set.

@thisisgit
Copy link

@tkserver

You need to install idb

brew tap facebook/fb
brew install idb-companion
pip3 install fb-idb

Source: https://github.com/facebook/idb

When IDB is installed, launch Flipper and click on File -> Preferences

Toggle on iOS Developer and Enable Physical iOS devices

And you can set your IDB Path in IDB binary location.

In my case Idb path is /Library/Frameworks/Python.framework/Versions/3.9/bin/idb

And if you don't know the path you can execute that cmd which idb

Hope my instructions will help you :)

I'm using Flipper 0.91.2 but the above solution didn't work for me.

Few different points were:

  • My IDB's location is at /usr/local/bin/idb
  • Had to install fb-idb with sudo since it kept complaining that command not found. Found the solution here.
  • Not sure if this problem is related to this issue, but I see the same error when I run the command, idb list-targets

Despite those different points, the setup doctor says IDB is correctly installed but still, my mac gets slower and hotter as I open the Flipper longer so I have to close it after I'm done with debugging. Anyone faced same issue as mine?

@keeprock
Copy link

As I understand that correctly, the issue is arm vs x86_64 arch, which Flipper uses underneath. I've installed idb using this guide facebook/idb#649. But it is still x86.

There is the comment which successfully installed an M1 version of Flipper (facebook/idb#649 (comment)) but I can't make it work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants