Takes lot of time to Archive in Xcode

@zhangxm Yes, I built a new project from scratch.

I just tried with empty projects.

V3.2: I tried both the cpp-empty-test and a brand new empty project, clean+build took 4:04 for both builds. Archiving took a massive 11:02. The archive file “cpp-empty-test iOS 14-08-2014 20.22.xcarchive” is 20.1MB

I then went to V2.2.5, opened up the Samples/Cpp/HelloCpp project, clean+build took 0:44. Archiving took 0:44 also. The archive file “HelloCpp 14-08-2014 20.03.xcarchive” is 2.9MB

There seems to be quite a bit of difference. If you say this is normal due to the new module system then I’ll accept that.

I also tried archiving empty-test as usual it took nearly 8 to 10 mins. However the IPA file size was 4.4MB & Appstore app size 6.7 MB
The process which is taking long time is “building cocos2dx iOS” during this process it compiles 900 source files.

@zhangxm What is your system configuration ?

My system configuration:

  • Processor: Core i7, 2.3 GHZ
  • Memory: 8G 1600 MHZ DDR3
  • SSD: 256G
  • OS X: 10.9.3

Now, cocos2d-x integrated chipmunk by default. But i don’t think it will cause the problem.
@GMTDev I am not sure if new module system cause the problem. I am trying to find out the problem. I hope it is other thing cause the problem.

MacBook Pro
Processor: Quad Core i7, 2.3ghz
Memory: 16gb 1600 DDR3
SSD: 1TB
OS X: 10.9.4
Xcode 5.1.1
Latest Cocos2d-x from GitHub

Product -> Archive CPP Tests took 11 minutes

Same tests on my MacBook Air (slower with only 4GB) about 16 minutes.

Building for iPhones, iPads, iPad 64-bit

1 Like

@slackmoehrle
Whether using distcc makes compilation faster ? is it compatible with Xcode ?

I have:

  1. MBP, 15 inch, quad-core i7, 16gb RAM, 1tb SSD.
  2. MBA, Core i5, 4gb RAM, stock off the shelf
  3. MBP, 13 inch Core2 Duo, 16GB RAM, 1tb HD
  4. Mac Mini, Core i5, 16gb RAM, 750gb HD

Using distcc as a command-line process that runs at system startup, doesn’t interfere with any using any of the machines in anyway. They see nothing. It is comparable with Xcode as distcc was what Apple was using before they got rid of it. I’m not sure why they got rid of it even. It has been great.

Progress report:

  • Include all c++ codes into one static library, let linker remove unused codes. It is finished in github codes.
  • Remove unneeded including header files: https://github.com/cocos2d/cocos2d-x/pull/7890. It is not finished.
  • Add cocos2d.h into cocos/cocos2d-prefix.pch. It is a precompiled header file.

I will continue to remove unneeded “include”. I am not sure how fast after i finish.
Any suggestions about reducing compiling time is appreciated.

This is great. I’ll run a git pull origin and try to archive a project tonight on my slowest machine and see how much it is reduced.

I just tried the latest code from github. But when i was running empty test it was giving some 15 errors like
cocos2d-x/cocos/editor-support/cocostudio/DictionaryHelper.h:28:10: ‘json/document.h’ file not found etc

But i still tried to archive that project it compiled 1299 source files & it took around 5 mins before it showed archive failed.

Yeah the external folder is missing most of its subfolders, I copied them in from 3.2 and it built.

But, the build time hasn’t changed, now 5:10 to build the cpp-empty-test iOS on my Mac (now 433 files to build so 1min longer).

I did a video capture of my builds on V2.2.4 and V3.2 and compared the time to build the same selection of files (as much the same as possible), I looked at the “build target cocos2dx iOS” build.

As you can see in the image, it took V2 9 seconds to build the first 39 files, in the same time V3 had built just 11.

Similar times building for Android.

So I guess it is all just down to the new file structure. Once built of course you are only compiling your own changed files so it isn’t too bad.

Perhaps I need to invest in an SSD and a processor with more than two cores (on a 2.7 i7 duel core at the moment).

SSD’s are really nice. I bought this:

and upgraded my 15 inch MBP.

@slackmoehrle you seem to have deep pockets… time for an upgrade

@GMTDev - LOL, Trust me, I wish. I actually got it cheaper since I had a credit and a promo code for some survey I participated in.

Guys, thanks for your help.
As @GMTDev said, it build less files in the same time in v3.x.But i have not idea about it now. The big change is that we use c++11 and clang for v3.x. I am not sure if it is the reason. I will continue to work out it.

And you should run download-deps.py after synchronized codes from github.

Now Box2D, chipmunk and spine are using source codes, we will use their prebuilt versions to reduce compiling time.

Okay i did download-deps.py . Now its compiling without errors.
On my iMac
2.5 GHz i5
4GB Ram

it took 6.01 minutes to archive empty test project (Earlier it was taking 8 to 10 mins)
Appstore app size is 7.4MB

@krithik_b007
Thanks for your test.
I am continue to remove unneeded includes and will use prebuilt version of Box2D, chipmunk and spine.

Hi, this issue is also effecting us. Our builds take around 25mins when archiving(on iOS)
One things I have noticed is that during archive te cocos2d libs compile 900 files whereas in debug mode it only compiles 300 files. Is this normal?

I’ve also noticed our builds are about 10 meg lighter when using static libraries.