Optimize build time in iOS app - gpeegpee/learn-swift GitHub Wiki

Tips to optimize build time

  • (๋ถ„์„)Xcode ์ƒ๋‹จ์— ๋นŒ๋“œ์‹œ๊ฐ„ ๋‚˜์˜ค๊ฒŒ ํ•˜๊ธฐ
defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool YES
  • (๋ถ„์„)๋นŒ๋“œ ์˜ค๋ž˜ ๊ฑธ๋ฆฌ๋Š” ์†Œ์Šค ์ •๋ณด ๋‚˜์˜ค๊ฒŒ ํ•˜๊ธฐ: Other Swift Flags์— ์•„๋ž˜ ์ถ”๊ฐ€
-Xfrontend -warn-long-function-bodies=100
-Xfrontend -warn-long-expression-type-checking=100
-Xfrontend -debug-time-function-bodies
  • (๋ถ„์„) Build with timing summary ์ •๋ณด ๋‚˜์˜ค๊ฒŒ ํ•˜๊ธฐ

    • Product-> Perform Action -> Build with timing summary
  • Project ๋นŒ์Šค ์„ค์ •์„ new build system์œผ๋กœ ์„ ํƒ

  • Debug ๋นŒ๋“œ์‹œ Build Active Architecture Only๋ฅผ YES๋กœ ์„ค์ •

  • Compilation Mode๋ฅผ Incremental๋กœ Optimisation Level์„ No optimization์œผ๋กœ ์„ค์ •

  • dSYM Debug๋ฒ„์ „์—์„œ๋Š” ์ƒ์„ฑํ•˜์ง€ ์•Š๋„๋ก ํ•˜๊ธฐ

    • Debug Information Format์—์„œ DWARF๋กœ ์„ค์ •ํ•ด์„œ dSYMํŒŒ์ผ ์ƒ์„ฑ๋˜์ง€ ์•Š๋„๋ก ์„ค์ •
  • ๋ณ‘๋ ฌ ๋นŒ๋“œ ์ˆ˜ํ–‰ํ•˜๋„๋ก ์„ค์ •

    • open your scheme editor, select โ€œBuildโ€ in the sidebar and make sure โ€œParallelize Buildโ€ is checked at the top.
  • Xcode Schemes์—์„œ Run์‹œ Test๋Š” ์ œ์™ธ๋˜๋„๋ก ์„ค์ •

  • Limiting your Objective-C/Swift interface: https://patrickbalestra.com/blog/2018/08/27/improving-your-build-time-in-xcode-10.html

Reference