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
Xcode build extremely slow - only when using cloud_firestore plugin #37582
Comments
cloud_firestore
cloud_firestore
cloud_firestore
@collinjackson @blasten Any thoughts on this? This is a serious issue for development if each build takes this long. I have seen other issues related to "slow Xcode builds" (or something similar) but I don't think anyone has explicitly tied it to |
I think this is related to #27771 and possibly #24909- but that thread is quiet and no responses. @orestesgaolin @JosephDunivan @jrm2k6 have you found any solutions for this? |
I don't have much insight on solutions to offer here but I can reproduce the issue. It seems to be a build issue that happens when adding a dependency on the Firestore CocoaPod to a Flutter app. Building the basic "flutter create" example app normally takes around 17 seconds for me according to
Here's what's getting pulled in when you include the Firestore CocoaPod:
I'm not sure if there's much we can do on the Flutter side as it's all stuff that Firebase is pulling in automatically. I didn't see any issues in the https://github.com/firebase/firebase-ios-sdk database referencing build times but you could open an issue there if you think that there's something that could be done. |
We also have this issue in our project and it's stopped us using Firestore specifically because of this problem |
@walsha2 No solutions found except waiting, unfortunately. It was for a side project of mine, so not a big deal and I have moved on anyway. |
@collinjackson thanks for replying. Ok yea I noticed that too and assumed it was something in those other pods that My only question now is, how is anyone using firestore and flutter? I'm surprised that this is not a problem that every person is having. My only explanation is that there must be some sort of iOS and/or Xcode version dependency that keeps other users from seeing it? I spent more time than I want to admit looking into each of those pods to see if I could glean anything. First hunch was to see if the new Apple FIle System (APFS) shipped with 10.13+ has anything to do with it. I did notice that
I could not link the above APFS related issue directly with compile time, but it does seem notable. Other than that anything I am not sure what to do to elevate this issue to core Flutter/Firestore team. I feel like if Flutter is to be adopted as a framework, the first logical backend to use is Firestore and one would think that it would be somewhat seamless (even in this beta stage). An issue like this could be a nonstarter for some developers and might be enough to detour some early adopters away from the framework altogether. |
There's an open PR to fix the protobuf warning issue: protocolbuffers/protobuf#6464. |
The best way to elevate Flutter issues is to use thumbs-up since that's how we're prioritizing our efforts. For local builds, I wonder if precompiled CocoaPods dependencies would help. https://guides.cocoapods.org/plugins/pre-compiling-dependencies.html |
Unscientifically on my machine, times for each library: |
It sounds like the pod install is essential the build framework/plugin equivalent for iOS? |
@jonahwilliams I'm not sure I understand your question, but pod install downloads and installs new pod source files, and writes the version it has installed, for each pods, in the Podfile.lock file. Those files then get compiled during the later (slow) build step. I tried
I didn't see an obvious solution but haven't put much time into it yet. |
Try adding |
For me, pre-compiling seems to work (but takes a really long time, way way longer than the XCode build in the first place), but it's result is destroyed by I also tried to downgrade various pods and flutter dependencies, but the problem remains, making my build take a staggering 10 minutes. Hardly a friendly F5 debug experience. Are there any known workarounds how to be able to at least develop/simulate the firestore functionality until hopefully someone comes up with a great idea? |
@joepb - no "great idea" here - I just ended up biting the bullet and writing a cloud function API to perform all the Definitely not ideal but for my Example below, just pointed to my cloud function URL and parsed the JSON response for a given query. https://flutter.dev/docs/cookbook/networking/background-parsing#complete-example |
Thanks. Indeed afraid I'll have to resort to an API, good tip. As I was just typing this reply, I was running VSCode build (against my better judgement) and when it finally finished (>15 minutes) I restarted the debug sessions. And what do you know... It only took 10 seconds! That was running with When I changed the version back to I have no clue what I did. I'm not using the pre-compile thing anymore, so that's not it. If there are any files I can share to help investigate, please let me know. |
We don't have a timeline on a fix for this yet (patches welcome). My suggestion for next steps would be to try to figure out if it's an issue with Flutter's template iOS app or if it affects all non-Flutter apps using the Cloud Firestore CocoaPod. |
I just installed the newest grpc in my pubspec and it seems to help. I noticed it was loading lots of files that related to the plugin building in Xcode once. I do that for every flutter project. I’m not sure if this actually helps or not but it was unusual. I haven’t had time to look into it.
|
I tried adding a FirebaseCore and FireStore into an empty iOS project (non-flutter). The build time doesn't seems to be very long. |
Current SetupBase project built with
All builds are tested with the following commands:
Issue Update and Development PingJust another ping for this issue and update on what I am seeing with the latest versions. @cyanglaz can you provide more details? I just tested the same exact process discussed in #37582 (comment) and that resulted in: Base Project
Base Project v2Added the following to
No
Base Project v3Add in
With
|
I created a new Swift/Kotlin Flutter project, added the 34 plug-ins I use in my current project excluding Firestore, and built for iOS and Android. After a couple of attempts, Android clocked in at 41 seconds on average, iOS settled at 50 seconds. Then I added Here are the plug-ins I added to the new Flutter project, with the culprit
And here's my build script for iOS, with the Android build step commented out:
|
@escamoteur @therealjohnsummer Here are details of my iOS build times. Build time without Firestore after building a couple of times without any changes:
Build time with Firestore for the first time:
Build time with Firestore after building a couple of times without any changes:
Build times fluctuate quite a bit all the time:
|
@ksilz Thanks for reporting some of your metrics. I don't know if this is exactly related but I find the fact that the times "fluctuate" to be peculiar. I wonder if it has to do with this comment from @JosephDunivan in #24909:
Perhaps the fluctuation (and maybe even the build slowness) is really not part of the "build" process, but actually due to network traffic and having to download files? I have no evidence of this, but always took note of @JosephDunivan comment and your post triggered that memory. Just trying to spur discussion to hopefully get this issue resolved or investigated by the flutter/firebase teams. |
@walsha2 I don't think it's got something to do with network downloads. To exclude downloads, I run a couple of builds to make sure that I got all downloads cached and Xcode is warmed-up. I use iStat Menus to put an upload/download counter in my menu bar. I don't see significant downloads there during the build. I think Xcode is just moody, for the lack of a better term. I just ran three iOS builds again, just switching to a browser in-between: 1m45s for the first build, 1m28s for the second one, and 1m26s for the third one. I think the shorter times for subsequent builds could be the result of caching on the OS level: The build touches a lot of files, and more of them are in the macOS caches after the first build. I got 32 GB of RAM, so there's some space for a file cache. 😁 |
I am facing the same issue.It was talking ~ 15min to build the project using the new build system. After going back to legacy build, it is now ~4 min for clean build and ~ 30 sec for cached build |
@FarmaanElahi What's a legacy build? |
@kbrmimbyl On Xcode -> File -> Project Settings -> Build system you can switch between "New Build System" and "Legacy Build System". However, in my case switching to "Legacy Build System" does not improve build time at all. Bitrise takes longer than 40 minutes as soon as you add cloud_firestore plugin. My hope was to not to use_frameworks on Podspec, which seemed to do things a little bit faster, but it was a false positive. I've tried every recommendation without joy :( It's so painful that we are dropping usage of cloud_firestore on all our applications until a permanent fix is found. |
Thanks @snadal. I think Firestore is worth dropping for other reasons, too. I've tried it for a year now. The moment you want your code to come of age, Firestore fails you. |
I try flutter firebase tutorial from codebase.* When i add FireStore to dependencies, it takes so long time to build with this message: (This is taking an unexpectedly long time.) When i change a few setting like Legacy Build System, it is getting worse. I always get this error in VS Code: Could not find the built application bundle at build/ios/iphonesimulator/Runner.app. Really annoying. |
This issue has been moved to firebase/flutterfire#349. Any further collaboration will be done there. |
Not sure if others have noticed: this whole "extremely slow" issue didn't exist in Flutter 1.0.0. |
@kbrmimbyl Just to confirm... do you mean that in 1.0.0 it was building without delays and this issue was included on subsequent versions? |
Yes.
|
I’ve noticed that build times vary a lot. From around 30 seconds and up to
230 for the same project. Once it’s around the upper side of the range,
however, it will stay on that side. Even after a full restart. This leads
me to believe that this is somehow related to the computer’s cooling
system. If I let the computer cool then the build time goes down again. I
don’t know exactly why this happens but I’m very interested in finding a
solution because this condition severely impacts development cycle time and
it renders features that improve development cycle time like hot reload
meaningless next to it.
I suspect this condition is beyond Flutter’s scope because it happens
during Xcode’s build command, nevertheless, I think it’s worth
investigating and understanding where it comes from so that we can continue
to build apps in record time.
On Sat, 14 Dec 2019 at 08:06, MobileMon ***@***.***> wrote:
for me its just the first time building and running the app its very slow.
Subsequent times after that are faster albeit still on the slow side
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#37582?email_source=notifications&email_token=AAA3NC6RQ6VY57DMFSOPLU3QYTSADA5CNFSM4IJFVKR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4DJTY#issuecomment-565720271>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA3NC6TBPRTOXGATY4BZTLQYTSADANCNFSM4IJFVKRQ>
.
--
Mauricio Zepeda
WA: +52.1.5586863600
LI: https://www.linkedin.com/in/mauzepeda/
|
@mauzepeda this is now being tracked here firebase/flutterfire#349 (official thread on this issue) Best to comment there to give this issue as much visibility as possible so the flutter/firestore team can hopefully resolve. |
same here. |
Same problem. |
same problem. it has been like 1 year. It's actually better if I just build runner in Xcode |
same here... |
a working solution can be found (copied below) with more detail in firebase/flutterfire#2751 note to apply, lookup the current tag for the specific repo shown, then in
this immediately resolved all slowness when initially implementing cloud firestore in my project (once it worked--in my case updating the tag to latest was necessary) |
Hello there, I tried to
Build time came down from 9 min to 1~2 min max. Please try it. Hope that helps :) |
after 1 and half year still taking long time to build iOS . and it does effect my development. i keep waiting so long that I lost My Focus. |
I don't have a noticeable problem when I build on my laptop. However, the situation on CI is different for iOS. I have/had these dependencies in my pubspec.yaml file:
Android iOS It takes around 25 minutes on Azure to build for iOS with the above dependencies. I have a task to export ipa after the build. |
This Flutter issue is closed, and it instead being tracked by the Firebase team FirebaseExtended/flutterfire#2751. You should comment on that thread so the team who can actually make improvements to this can see it. |
Summary of Issue
Simply adding
cloud_firestore
topubspec.yaml
results in a huge increase in iOS xcode build times. The issue can be recreate with nothing more than a simpleflutter create
application and minor changes topubspec.yaml
.Without
cloud_firestore
Just to show that it is specifically the
cloud_firestore
plugin that causes this issue I will add some other firebase plugins topubspec.yaml
:Now we build the app:
Okay that looks reasonable.
With
cloud_firestore
Simply add the latest version of
cloud_firestore
plugin topubspec.yaml
(no other changes):Now we build the application again:
Yes... that is right. A six minute increase in iOS build times just from adding the
cloud_firestore
plugin topubspec.yaml
. Again, no changes were made to theflutter create
generated application, this is simply changes topubspec.yaml
.Logs
I did confirm that this issue persists on other
flutter
channels as well as other later versions ofcloud_firestore
plugin.The text was updated successfully, but these errors were encountered: