LoginSignup
45

More than 5 years have passed since last update.

Xcode8でコンパイルが遅いのを解消する

Posted at

Xcode8にしてからとてもコンパイルが遅くなった(気がする)

スクリーンショット_2016-10-05_21_37_29.png

ここから、コンパイルしている様子を見ることができる。

スクリーンショット_2016-10-05_21_43_34.png

ここで、矢印が一度にいくつ表示されているかが重要。
この場合は「4つ」同時に処理されている。

もしも同時に1つしか処理されていないのであれば

defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4

を実行すれば4コアで処理してくれる。
もちろん2コアのMacなら

defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 2

のように指定すれば最適なパフォーマンスでコンパイルしてくれる。

コア数は

system_profiler SPHardwareDataType

を実行すると

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro11,4
      Processor Name: Intel Core i7
      Processor Speed: 2.2 GHz
      Number of Processors: 1
      Total Number of Cores: 4
      L2 Cache (per Core): 256 KB
      L3 Cache: 6 MB
      Memory: 16 GB
      Boot ROM Version: MBP114.0172.B09
      SMC Version (system): 2.29f24
      Serial Number (system): xxxxxxxxxx
      Hardware UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx

のように表示されるので、Total Number of Coresを見れば良い。
上記の場合は4

設定したらコンパイル中に灰色の矢印が増えているか確認。

Xcode8じゃなくてもたぶん効くはず

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
45