flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[cloud_firestore] Xcode build extremely slow

Open kroikie opened this issue 7 years ago β€’ 134 comments


EDIT (@Salakar): See https://github.com/FirebaseExtended/flutterfire/issues/2751 for a solution.


Summary of Issue

Simply adding cloud_firestore to pubspec.yaml results in a huge increase in iOS xcode build times. The issue can be recreate with nothing more than a simple flutter create application and minor changes to pubspec.yaml.

MacOS Mojave 10.14.6
Xcode 10.3
> flutter --version
Flutter 1.8.4-pre.91 β€’ channel master β€’ https://github.com/flutter/flutter.git
Framework β€’ revision 8fdd759225 (11 hours ago) β€’ 2019-08-04 00:56:23 -0400
Engine β€’ revision c8f4f5d5cc
Tools β€’ Dart 2.5.0 (build 2.5.0-dev.1.0 9bb446aae1)
> flutter create test_cloud_firestore
> cd test_cloud_firestore

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 to pubspec.yaml:

firebase_core: ^0.4.0+1
firebase_analytics: ^4.0.2

Now we build the app:

> flutter packages get
> time flutter build ios
....
Xcode build done. 
real	0m41.014s

Okay that looks reasonable.

With cloud_firestore

Simply add the latest version of cloud_firestore plugin to pubspec.yaml (no other changes):

cloud_firestore: ^0.12.9

Now we build the application again:

> flutter packages get
> time flutter build ios
....
Xcode build done. 
real	6m40.982s

Yes... that is right. A six minute increase in iOS build times just from adding the cloud_firestore plugin to pubspec.yaml. Again, no changes were made to the flutter create generated application, this is simply changes to pubspec.yaml.

Logs

I did confirm that this issue persists on other flutter channels as well as other later versions of cloud_firestore plugin.

> flutter doctor -v
[βœ“] Flutter (Channel master, v1.8.4-pre.91, on Mac OS X 10.14.6 18G84, locale en-US)
    β€’ Flutter version 1.8.4-pre.91 at /Users/taza/Applications/flutter
    β€’ Framework revision 8fdd759225 (11 hours ago), 2019-08-04 00:56:23 -0400
    β€’ Engine revision c8f4f5d5cc
    β€’ Dart version 2.5.0 (build 2.5.0-dev.1.0 9bb446aae1)

 
[βœ“] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
    β€’ Android SDK at /Users/taza/Library/Android/sdk
    β€’ Android NDK location not configured (optional; useful for native profiling support)
    β€’ Platform android-29, build-tools 29.0.1
    β€’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    β€’ All Android licenses accepted.

[βœ“] Xcode - develop for iOS and macOS (Xcode 10.3)
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Xcode 10.3, Build version 10G8
    β€’ CocoaPods version 1.7.5

[βœ“] Android Studio (version 3.4)
    β€’ Android Studio at /Applications/Android Studio.app/Contents
    β€’ Flutter plugin version 37.1.1
    β€’ Dart plugin version 183.6270
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[βœ“] VS Code (version 1.36.1)
    β€’ VS Code at /Applications/Visual Studio Code.app/Contents
    β€’ Flutter extension version 3.3.0

kroikie avatar Oct 13 '19 18:10 kroikie

@walsha2

The issue at https://github.com/flutter/flutter/issues/37582 has been closed and moved here. Future collaboration on this issue will be done here.

kroikie avatar Oct 13 '19 18:10 kroikie

@kroikie Ok. So does this new issue lose all the traction of https://github.com/flutter/flutter/issues/37582 in terms of user reaction and up votes. From what I gather, that is what determines what gets worked on in the priority queue.

I just want this "new" issue to have the same level of priority as the previous one did, which seemed to be a concern that was pretty widespread in the community.

walsha2 avatar Oct 13 '19 18:10 walsha2

@walsha2 no we will still refer to the linked issue for reference during triage. The goal is to collect all future FlutterFire collaboration in a single place.

kroikie avatar Oct 13 '19 20:10 kroikie

@kroikie Still no solution for this? I have been struggling with this issue for days...

rdmo94 avatar Oct 16 '19 08:10 rdmo94

Not sure if others have noticed: this whole "extremely slow" issue didn't exist in Flutter 1.0.0.

kbrmimbyl avatar Oct 24 '19 12:10 kbrmimbyl

Update: Building my application in an iOS Simulator is still very slow (sometimes above 500 seconds) and the problem seems to arise when using cloud_firestore plugin. So now i use my device instead. I build it through Xcode and attach flutter afterwards with "flutter attach -d device name" in terminal.

rdmo94 avatar Oct 24 '19 12:10 rdmo94

I also encounter this problem on i7 MacBook Pro. Adding cloud_firestore increased my build time to simulator from 1-2 minutes (60-120 sec) to more than 7-10 minutes and release build on CI to over 15-20 minutes.

Sample output from deploying to simulator:

Launching lib/main_dev.dart on iPhone 11 in debug mode...
Xcode build done.                                           458,6s

This was not clean build but some changes to dart code have been made. Previous clean build with pod install took over 600 sec.


Edit: switching to current master dropped this number to about 250-270 sec on a clean build!

[βœ“] Flutter (Channel master, v1.10.15-pre.271, on Mac OS X 10.15 19A602, locale pl-PL)

orestesgaolin avatar Oct 27 '19 12:10 orestesgaolin

Due to this problem I'm no longer developing on Mac even for iOS. I do most of the development on Ubuntu Linux using an Android emulator and then switch to Mac to run the same code on the iOS emulator. Very painful... but running on Mac isn't an option.

On Sun 27 Oct, 2019, 5:32 PM Dominik Roszkowski, [email protected] wrote:

I also encounter this problem on i7 MacBook Pro. Adding cloud_firestore increased my build time to simulator from 1-2 minutes (60-120 sec) to more than 7-10 minutes and release build on CI to over 15-20 minutes.

Sample output from deploying to simulator:

Launching lib/main_dev.dart on iPhone 11 in debug mode... Xcode build done. 458,6s

This was not clean build but some changes to dart code have been made. Previous clean build with pod install took over 600 sec.

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/FirebaseExtended/flutterfire/issues/349?email_source=notifications&email_token=ADTXR43V5HD5XFOJVU57MTLQQVYLJA5CNFSM4JAIAHWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECK4WBQ#issuecomment-546687750, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTXR46Q2UWD3AUFNUYOHJDQQVYLJANCNFSM4JAIAHWA .

kbrmimbyl avatar Oct 28 '19 01:10 kbrmimbyl

Same here, I started considering buying new machine...but i see that thats not really the case. Any workaround ? is there any chance to include firestore as pre-compiled binary ?

rdev-software avatar Oct 28 '19 21:10 rdev-software

Here is my flutter doctor and pubspec if its useful, the same issue is happening to me. Very slow to build on iOS

[βœ“] Flutter (Channel master, v1.10.15-pre.362, on Mac OS X 10.15.1 19B88, locale
    en-US)
 
[βœ“] Android toolchain - develop for Android devices (Android SDK version
    29.0.0-rc2)
[βœ“] Xcode - develop for iOS and macOS (Xcode 11.2)
[βœ“] Chrome - develop for the web
[!] Android Studio (version 3.5)
    βœ— Flutter plugin not installed; this adds Flutter specific functionality.
    βœ— Dart plugin not installed; this adds Dart specific functionality.
[!] Android Studio (version 3.4)
    βœ— Flutter plugin not installed; this adds Flutter specific functionality.
    βœ— Dart plugin not installed; this adds Dart specific functionality.
[βœ“] IntelliJ IDEA Ultimate Edition (version 2018.1.8)
[βœ“] VS Code (version 1.39.2)
[βœ“] Connected device (3 available)
dependencies:
  flutter:
    sdk: flutter
  fluro: "^1.5.1"
  flutter_secure_storage: ^3.3.1+1
  firebase_core: ^0.4.0+9
   # Add the dependency for the FlutterFire plugin for Google Analytics
  firebase_analytics: ^5.0.2

  # Add the dependencies for any other Firebase products you want to use in your app
  # For example, to use Firebase Authentication and Cloud Firestore
  firebase_auth: ^0.14.0+5
  google_sign_in: ^4.0.11
  cloud_firestore: ^0.12.9+5

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  avatar_glow: ^1.0.0

Screen Shot 2019-11-01 at 1 23 29 PM

FaisalAbid avatar Nov 01 '19 17:11 FaisalAbid

Can confirm the super ugly build times with Firestore too. Sometimes getting like peak 230 seconds on a quite fast Macbook Pro. This is really barely usable at this point. Unfortunately we need Firestore.

This was my latest build Running Xcode build...

β”œβ”€Assembling Flutter resources... 4,5s └─Compiling, linking and signing... 12,5s Xcode build done. 130,7s

logemann avatar Nov 03 '19 19:11 logemann

adding @collinjackson for his thoughts on this issue

csells avatar Nov 14 '19 17:11 csells

I found this thread, and its source, having encountered the same problem -- ios build time dramatically escalated after adding cloud_firestore. I didn't clock it, but I know it was well over 10 minutes, perhaps bordering on 20.

Is there anything I can do to assist, keeping in mind I know very little on objc/swift/pods ? Compounded with having to randomly create bridge files and adding/removing use_frameworks, neither of which do I understand when and why and what and just follow whatever google shows me, ios building is becoming frustrating. So, instead of being afraid to look at the code in fear it may break and never build again, what can I offer?

alevinetx avatar Nov 19 '19 05:11 alevinetx

@alevinetx @csells From what I observed, main problem is constant rebuilding. And those firebase libs are compiling huge amount of some C files. I have Core I7 8700, 32GB, NVME hackintosh which is really snappy...but with this, sometimes it takes minutes to build. On my macbook 15" pro late...its kind of impossible to develop, at is so frustrating

rdev-software avatar Nov 19 '19 05:11 rdev-software

Worst thing is that bitrise or codemagic can not be used with cloud_firestore, as it crosses the 20 minutes build time :(

I tried many things but no significant improves. Every archive operation takes forever.

snadal avatar Nov 19 '19 07:11 snadal

@snadal @rdev-software @alevinetx maybe try to switch to dev channel for now, build times are a bit shorter there. I also couldn't stand so long build times and switched to Android device.

orestesgaolin avatar Nov 19 '19 07:11 orestesgaolin

Yeah dev channel is way better currently when it comes to build times.

logemann avatar Nov 19 '19 09:11 logemann

I also noticed my IPA is significantly larger, 16M -> ~50M, and I haven't changed the way I'm doing the build. I could assume a correlation, but I'm honestly lost right now.

alevinetx avatar Nov 19 '19 18:11 alevinetx

I also noticed my IPA is significantly larger, 16M -> ~50M, and I haven't changed the way I'm doing the build. I could assume a correlation, but I'm honestly lost right now.

So bad that an uploading plugin takes around 35M πŸ˜…this really needs to be fixed. Getting build times up to 300 seconds on a 2018 Macbook Pro...

ro0t avatar Nov 19 '19 21:11 ro0t

Would just like to chime in and say that I think that in addition to it taking long time to build, it seems like something is broken with the caching as well. If I plug out my phone and then come back to my computer and run "Start debugging" in VS Code again it takes minutes for the "Running Xcode build" step to complete. It's really a productivity killer 😞

LinusU avatar Nov 20 '19 12:11 LinusU