-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[Update] Cloud Firestore Xcode Build Times #2751
Comments
This actually works for more than flutter, for react-native-firebase or anyone that integrates the firestore pod it works, I know this because my creaky old 4 core mbp takes about 5mins less to compile and get the app running. 1 line! Thank you. |
Yep, works for anyone using Firestore on iOS - no matter the framework 🎉 |
Thanks for the tip.
I tried to pod update, but with no luck Any idea ? |
@jsoms try removing your |
I started simple tests on codemagic and there's at least few minutes decrease in iOS build time. Unfortunately cache upload caused the total build to be still rather long. I'm going to update this table with next results. Flutter stable 1.17.3
pro means that it was run on Mac Pro Important remark when using cache the Android build is significantly shorter (eg 15 vs 9 min). Also cache usually takes 2 min to download and 4-6 min to create and upload. |
@orestesgaolin what's it like without uploading build caches? |
@Salakar I updated my comment above and it's so surprising to see that without any cache (i.e. completely clean build on new workflow) the build time dropped dramatically to about 13 min. I'm gonna run it again without any cache |
@Salakar second build without cache was a bit longer, so it seems that it doesn't have significant effect (thus it may be completely unnecessary to use). I will be collecting data in subsequent builds and maybe we can then draw some conclusions out of it |
Note using @Salakar Created issue to add |
Could you help me?
And I got this:
What must I do? |
@ElaineSchwner I solved a similar problem with |
Solved ! |
It worked well. Thanks a lot 🛩️ 😄 |
This didn't work for me. I tried
|
Hi @RaviKavaiya we'll need more information to help on that one. It looks like the XCode build succeeded but then fails when the app is launched - what are the errors? |
@Ehesp I tried running with flutter run -v. Couldn't find anything. Will give another shot later and will tell you.. Thanks |
Build timings on my MacBook Pro (2018) 4 cores:
A very nice speed improvement, thank you! How can we tell which version of the iOS SDK the |
I've raised an issue against the |
On an old Macbook Pro ( 2011 - 2 cores - i7 ) before ~ 15 minutes Thanks! |
Is there also a workaround for Flutter macOS? |
@AndroidNils unfortunately this is only for iOS |
Use folliwing line for
for your puspec |
@zumrywahid a more general recommendation (as your recommendation will go out of date as versions are released) is to consult the exact location that the firebase-ios-sdk is defined for the That's right here: https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_core/firebase_core/ios/firebase_sdk_version.rb#L2 And it's possible to inspect tags / versions on that file in case you are not using the latest version It is currently 7.3.0 as you mention though, yes :-) |
I get this error:
NOTE: I changed the tag from My target 'Runner' do
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.0.0'
# :tag => '7.4.0'
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end My dependencies:
flutter:
sdk: flutter
cloud_firestore: ^2.0.0
cupertino_icons: ^1.0.2
email_validator: ^2.0.1
firebase_auth: ^1.1.3
firebase_core: ^1.1.0
flutter_icons: ^1.1.0
shared_preferences: ^2.0.5
intl: ^0.17.0
scrollable_positioned_list: ^0.1.10
provider: ^5.0.0
flutter_markdown: ^0.6.2
flutter_slidable: ^0.6.0 This might help as well:
Any help would be appreciated :) |
You should take the version matching the one of your package. |
Sorry, I have absolutely no experience in iOS development. What file am I supposed to edit? |
I changed this: pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.0.0' ...to this: pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '7.11.0' ...and ran |
The build still takes a long time... It took 8 minutes. Is this because it was the first build since I modified the These are my dependencies: dependencies:
flutter:
sdk: flutter
cloud_firestore: ^2.0.0
cupertino_icons: ^1.0.2
email_validator: ^2.0.1
firebase_auth: ^1.1.3
firebase_core: ^1.1.0
flutter_icons: ^1.1.0
shared_preferences: ^2.0.5
intl: ^0.17.0
scrollable_positioned_list: ^0.1.10
provider: ^5.0.0
flutter_markdown: ^0.6.2
flutter_slidable: ^0.6.0 |
I think it's actually working! I just built my app again to work on it a little bit, and the build finished in 82 seconds.
|
Could this appear in the explanatory text? I stumbled upon it and I guess an explanation would be helpful to other people, too. |
@Valentin-Seehausen hi there! If it is missing in some location that seems appropriate to you, I think in github you can just hit the little edit button on the README.md and suggest where it should be. We'd be happy to merge any reasonable change that would help users, most of our documentation is improved in that way since we (that is, the maintainers) are usually too closed to / used to things to have the perspective of fresh users anymore. |
Thank you, this worked well :) Make sure to check the actual Firebase version in Podfile |
guys, im using SwiftPackage manager, - the build times is usually 40-50mins thru CI/CD. this is O M G. is there a setting to speed this up. Tks. |
Depending on your CI/CD there are other tricks to speed it up since this doesn't do SPM yet Those are for github but the general solution design ("Install compiler cache tool, make symbolic links to the tool (or update your build definition to use it directly), save and restore compiler cache across builds") is generic and I have seen it work on bitrise as well so I know it's generally applicable. |
Trying to implement the automatic versioning based on what firebase_core uses (per #4698) but kinda hitting a wall. This line of course doesn't point to anything on my system - I also can't make assumptions about where it is on other members of my teams system's: Trying to find a replacement for this line I've come up with this:
which would allow me to reference the script file like this:
However flutter responds like this when I ty to build:
It seems that having any mention of EDIT |
Yes, significant improvement. Went from 568s to 32s (MBP 3.1 GHz Quad-Core Intel Core i7). Thank you! |
@mikehardy do you have a bitrise.yaml example? |
No, sorry. But I've heard of a successful bitrise implementation of ccache using xcodebuild directly on command line with variables LD/LD++/CLANG/CLANG++ set on the command line to the path of ccache |
Thanks. It works for me. True, I had to change the version from 7.14.0 to 8.10.0, if anyone has an error like that: [!] CocoaPods could not find compatible versions for pod "FirebaseFirestore":
|
It took 1hr before & 5 mins after using this. |
@irajeshh if you think that's neat (and it is!) imagine integrating ccache for your entire iOS build, so that everything (not just firestore) was only built when necessary... |
Omg this is scary my build times were more than 1hr and now it went to 10-20 secs... I followed step 4 from this url - |
Yeah it's okay for me, Also I just tested the |
Hey everyone 👋
One of the key issues we wanted to look into providing a solution for was #349 - improving build times for Xcode when using Firestore.
I'm happy to say we now have something for you to try (please provide feedback) that should significantly improve your build times;
Mac mini (2018) 6 cores:
GitHub Action CI 2 cores:
Why is it slow?
Currently the Firestore iOS SDK depends on some 500k lines of mostly C++ code (from dependencies such as gRPC), which when compiling as part of your Xcode build can take a long time - even more so in CI environments.
How can we speed it up?
The biggest win to improving build times would be to not have to compile all that C++ code. The way to do that would be to consume precompiled binaries, in the new
XCFramework
bundle type introduced to Xcode last year, luckily as part of the Firebase iOS SDK release process these bundles are generated and published in a zip containing all Firebase SDKs.To help you consume these quicker with the least amount of changes to your codebase we've created invertase/firestore-ios-sdk-frameworks - a repository that provides a drop in replacement podspec for Firestore that consumes the precompiled binaries instead, without you needing to download 3gb of SDKs and manually extract out the Firestore SDKs from the rest of the SDKs in the zip.
⚡ Setup ⚡
To integrate, you just need to add 1 line to your
ios/Podfile
inside your Flutter project;Add this line inside your
target 'Runner' do
block in your Podfile, e.g.:No changes to the FlutterFire packages were required. See #4698 for a full example of integrating with automatic versioning based on what
firebase_core
uses.Why not ship the binaries with the pub packages?
This would add ~200mb to every release. Whereas via a custom pod this is only ever downloaded once on your machine per Firebase iOS SDK version.
For more information on the
pod
and versioning please see the invertase/firestore-ios-sdk-frameworks repository.✨ Please let me know if this has helped you, and I would love to see some before and after timings if you feel like sharing ✨
The text was updated successfully, but these errors were encountered: