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.