iOS Builds slow, any solution to speed it up?

Thanks for the quick response. I tried running in multiple times on the same repo, always the same result. I then tried it on other repos from phabricator, and it also had a significant difference. Finally, I tried some repos from github, and most of them had a marginal difference as well.

One great example is Appleā€™s swift repo:

% git clone --depth=1 https://github.com/apple/swift.git ss                                                                                                                             ~/Developer/careem
Cloning into 'ss'...
remote: Counting objects: 12963, done.
remote: Compressing objects: 100% (7692/7692), done.
remote: Total 12963 (delta 5939), reused 6761 (delta 4978), pack-reused 0
Receiving objects: 100% (12963/12963), 12.99 MiB | 2.09 MiB/s, done.
Resolving deltas: 100% (5939/5939), done.
Checking out files: 100% (12432/12432), done.
(master) % git remote add origin https://github.com/apple/swift.git                                                                                                                  ~/Developer/careem/sf
(master) % git "fetch" "--depth=1"                                                                                                                                                   ~/Developer/careem/sf

remote: Counting objects: 51742, done.
remote: Compressing objects: 100% (24558/24558), done.
remote: Total 51742 (delta 39300), reused 34328 (delta 26672), pack-reused 0
Receiving objects: 100% (51742/51742), 25.35 MiB | 1.63 MiB/s, done.
Resolving deltas: 100% (39300/39300), done.
From https://github.com/apple/swift
2 Likes

Thanks for the infos @maz.careem!

Iā€™ll schedule a review for this and if we donā€™t find anything what would break because of this change then weā€™ll implement it and publish a new Git Clone step.

1 Like

Enthusiastically waiting for this, and to present to our with what a great service bitrise is providing :slight_smile:

1 Like

I agree, although as this is not a bug nor a major issue, the task got a ā€œnormalā€ priority on our task list.

If this is something you really really need, feel free to create a #feature-request, we do weight in the feature request votes when we plan our upcoming features/sprints.

Please consider adding the user-defined setting SWIFT_WHOLE_MODULE_OPTIMIZATION=YES flag in XCode, this will speed up compilation time drastically. Donā€™t let the optimisation level fool you, because that one should stay on ā€œNoneā€, and not be changed to ā€œ-whole-module-optimizationā€.

See this Hacker News thread https://news.ycombinator.com/item?id=13214431, with Uber (https://www.skilled.io/u/swiftsummit/swift-with-a-hundred-engineers) and Zalando (https://tech.zalando.com/blog/improving-swift-compilation-times-from-12-to-2-minutes/) mentioning it too.

3 Likes

Awesome tip @jelle.tapup, thanks for sharing it here!! :wink:

WWDC 2018: ā€œBuilding Faster in Xcodeā€: https://developer.apple.com/videos/play/wwdc2018/408/

1 Like

Hi all,

I would not create another topic for another speed up issue but Iā€™m stuck and I donā€™t know how to build faster my workflow. I already have the SWIFT_WHOLE_MODULE_OPTIMIZATION flag into my build settings.

Every step runs in few seconds but Xcode Archive takes ~30min for an AppStore build ! I canā€™t disable Bitcode such as our app will be too big on devices.

Itā€™s kind anoying such we have a team plan with only one concurrency build, iOS takes a very long time by it self :frowning:

Can I have some help @viktorbenei ? :slight_smile:

Thank you very much !

Weā€™re working on related caching improvements, which should roll out in the near future (will be built into our Xcode steps), as well as weā€™re in the process of upgrading all of our Mac build machines, both the Standard and Elite ones, to faster hardware in the next 1-2 weeks.

That said hardware itself isnā€™t that significant in case of a ~30 min Xcode Archive, I guess it doesnā€™t really matter if itā€™s 20 or 30 mins.

The caching improvements should improve that more drastically (we saw 30 -> 2-3 mins drops), but that will take a bit more time (a few weeks or months until ā€œpublic betaā€), itā€™s still in private beta/internal testing as we want to ensure it does not introduce any side-effect/issue.

@viktorbenei
Hi and thank you for the reply,

Good to know that new caching process will increase build times in the future.

But for now, is there any way to reduce archive time for production ? Even if we can ā€œjustā€ reduce from 30 to 20, it will be very great ! :slight_smile:

Thanks !

Is there a way to join the private beta? :blush:

New Macs are in production, you should see the build time reduction automatically. Weā€™re still tweaking some configs but it should be visible.

Iā€™ll ask @tamaspapik as heā€™s the one leading this initiative :wink:

@tibi_shapr3d working on it. Weā€™ll reach out as soon as the private beta is ready. :blush:

Cool, thanks guys!

Are these caching improvements available yet?

Hi!

It is still under closed beta testing!

Hi,

How do we sign up to try the new macs?

Hi @salman.muhammad! The discussion above isnā€™t about new hardware but a brand-new caching system for Xcode being developed by us :slight_smile: This is in closed beta at the moment, so there is no way to publicly apply at the moment :frowning: In case you need more build time in general, make sure to contact us on our on-site chat so we can take a look at your workflows and see what could be improved.