How to decrease build times / speed up compile tim

2019-01-16 01:50发布

What strategies can be used in general to decrease build times for any XCode project? I'm mostly interested in XCode specific strategies.

I'm doing iPhone development using XCode, and my project is slowly getting bigger and bigger. I find the compile / link phases are starting to take more time than I'd like.

Currently, I'm:

  • Using Static Libraries to make it so most of my code doesn't need to be compiled everytime I clean and build my main project

  • Have removed most resources from my application, and test with a hard coded file system path in the iPhone simulator whenever possible so my resources don't have to constantly be packaged as I make changes to them.

I've noticed that the "Checking Dependencies" phase seems to take longer than I'd like. Any tips to decrease that as well would be appreciated!

14条回答
可以哭但决不认输i
2楼-- · 2019-01-16 02:47

Often, the largest thing you can do is to control your inclusion of header files.

Including "extra" header files in source code dramatically slows down the compilation. This also tends to increase the time required for dependency checking.

Also, using forward declaration instead of having headers include other headers can dramatically reduce the number of dependencies, and help all of your timings.

查看更多
在下西门庆
3楼-- · 2019-01-16 02:51

one word: TmpDisk

  1. Use TmpDisk to Create a 1.5Gb RAM disk
  2. Change Xcode > Preferences > Location > Derived Data to /Volumes/1.5Gb/xcode data
  3. Enjoy the speed!
查看更多
登录 后发表回答