Compile time issue

git clone:

Cloning into ‘mywellness’…
remote: Counting objects: 76448, done.
remote: Compressing objects: 100% (32001/32001), done.
remote: Total 76448 (delta 53297), reused 58655 (delta 41786)
Receiving objects: 100% (76448/76448), 620.50 MiB | 1.94 MiB/s, done.
Resolving deltas: 100% (53297/53297), done.

real 5m43.180s
user 0m20.554s
sys 0m7.745s

There is no problem on my local machine using the same branch and commit (and same fastlane command):
[15:17:19]: ▸ Compiling uuid.cpp
[15:17:19]: ▸ Compiling weak_realm_notifier.cpp
[15:17:19]: ▸ Compiling Realm_vers.c
[15:17:19]: ▸ Linking Realm
[15:17:30]: ▸ Linking Realm
[15:17:31]: ▸ Generating ‘Realm.framework.dSYM’

I will notify you the total time as soon as the workflow is finished

:+1:

you can also try to Remote Desktop / VNC into the build VM: https://gist.github.com/viktorbenei/c6d4fe1e68de739dbb5f4f15de76b9db if that helps

How can I send you the build log of the workflow executed on my own mac?

Just updated Realm to version 3.1.0 and CocoaPods to 1.4.0 rc1 but there’s still the issues…
Everything works on my own machine

Did you try to remote desktop / VNC into the build VM @vscafuto? see :point_up: Compile time issue

How can it help me?

You can build it there and debug what takes so long.

I’d suggest you to investigate this, so that you can work with a pre-compiled version of Realm, or to debug why it takes so long to compile.

We’re trying with another app and we have the same issue as you can see here:
https://www.bitrise.io/build/22f3a0fbafd8fbda

Now I suppose that it could be a VM problem related with Realm and Swift 4
If you want, I could setup a new project with only Realm and try it again…

Viktor, I created a new “empty” app with one pod and Realm (version 3.1.0), and the problem has been the same. Look these buids: https://www.bitrise.io/app/ad6a0cecb978d3d0#/builds

Can you provide the sample’s code / make it open source? Would help a lot if we could access the code.

Send me your bitbucket profile, so I can add you :slight_smile:

viktorbenei works :wink:

Added to RealmSample

Ran an Archive on my own Mac and it took almost an hour here too (14:56:58 -> 15:42:24) using the Sample you shared.

Will run a new Archive and see if that’s faster.

@vscafuto did you try to Archive on your own Mac? Xcode Archive can be significantly slower / longer than a normal Build in some cases (it seems yours is one of those).

It also takes quite a bit of RAM, 3.5+ GB in two separate processes

43

while using 60+% of 2 CPU

05

Ran an Archive on my own Mac (macOS High Sierra 10.13.2) and it took almost 10 minutes as you can see:

I’m running the same archive on a Sierra machine, and it seems to be stuck on Realm like the Bitrise VM.
What’s your OS? Sierra or High Sierra?

I’m on Sierra.

Ran another Archive, that was faster, around 30-40 mins this time. Probably faster because of the previous build’s caches, or because I close a couple of programs.

What I saw during the archive in Activity Monitor was that to compile the Archive, Xcode (the swift process) started to “eat” memory like crazy, at some point it was above 4.5GB RAM per swift process. As I was working on my Mac in the meantime this pushed “Memory Pressure” into red in Activity Monitor, and that slowed down things quite a bit.

It very well can be a Sierra vs High Sierra thing too, although I never heard about an issue like this before - do you have a link, for Sierra vs High Sierra compile time diff?

Alternatively it can be due to the lack of free RAM.

For now I activated an Elite trial for the organization who owns the sample app you linked @vscafuto - the Elite machines have 2x RAM and 2x CPU core versus the Standard configs. We’ll see whether this helps to make the compile significantly faster :wink:

Now it seems to work, last build (https://www.bitrise.io/build/28e8d76c0c003139) took 22 minutes vs 77 minutes of the previous build…
Now I’m trying on the other app, I think we got it: https://www.bitrise.io/build/d873dbd57e39f7e5

Glad to hear! :slight_smile:

Unfortunately this means that your build process is indeed resource constrained (I’d say most likely RAM).

Good news is that the Elite config (for which I activated a ~1 day trial) seems to do the trick and it improves the times significantly. Bad news is that the Elite config is more expensive, it’s $100/concurrency/mo vs the Standard machines which are $50/concurrency/mo.

Of course in your case it definitely seems to worth it, as for 2x the price your builds can finish more than 2x faster, so even with 50% concurrency count you can build the same amount of builds in a given timeframe.