-
Notifications
You must be signed in to change notification settings - Fork 140
Description
Introduction
I noticed that iOS release builds became a lot slower since React Native 0.62, and it turns out that a lot of this can be explained by Flipper. By leaving Flipper out, I was able to see a ~50% reduction in build time on a simple project on my local machine and similar results on CI.
Local build times
A brand new app, with yarn ios --configuration Release
on a Macbook Pro with 2.4 GHz 8-Core Intel Core i9:
- with Flipper: 5m 11s
- without Flipper: 2m 33s
(ymmv depending on project complexity and other factors, of course)
CI build times
In a less powerful environment (Intel(R) Xeon(R) CPU E5-2697 with 6 cores available to VM), the same project had the following build times:
- with Flipper: ~10 minutes
- without Flipper: ~5 minutes
Details
It would be convenient to have some mechanism to exclude Flipper from CocoaPods when running pod install
. We could wire up our build scripts locally and on CI to run, eg: pod install --production
or pod install --release
, or set and environment variable (SKIP_FLIPPER=1 pod install
). The flag option seems preferable, but listed both anyways.
This could also be useful as a standard for other dependencies that the community builds in order to assist with development.
Discussion points
- What are our options? Above I have listed using
pod install
flags or environment variables. - Of the options, which is the best to solve for the current issue of ergonomics for excluding Flipper from release builds (locally and on CI)?
- Will this also work well in the future for other community libraries that may want the same behavior?
An aside
We should probably update the conditional include directives in the React Native template so they work in debug if Flipper is not installed. This works well for me:
#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)