如何在没有任何项目修改的情况下加速 xcode 构建?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2208926/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to speedup xcode builds without any project modifications?
提问by sorin
Last version or XCode (3.2.1) is running very slow on OS X 10.6.
最新版本或 XCode (3.2.1) 在 OS X 10.6 上运行速度非常慢。
What kinds of tweaks can you do to your Mac in order to speedup Xcode buildprocess.
您可以对 Mac 进行哪些调整以加快Xcode 构建过程。
I'm not looking for general hints like how to restructure your projects, just tweaks that are related to environment.
我不是在寻找诸如如何重组项目之类的一般提示,只是寻找与环境相关的调整。
For example I remember that on Windows for Visual Studio two significant speedups are to disable antivirus and NTFS last access time.
例如,我记得在 Windows 上 Visual Studio 的两个显着加速是禁用防病毒和 NTFS 上次访问时间。
So I'm aiming at something elsethan: hardware upgrades, project structure modifications or configuring distributed builds.
所以我瞄准的东西别人比:硬件升级,项目结构修改或配置分布式构建。
Update #1 - maybe limiting the number of cc1plus processes could help speeding up. I think there is an environment variable that can be used for this but I wasn't able to relocate this info.
更新 #1 - 也许限制 cc1plus 进程的数量可以帮助加快速度。我认为有一个环境变量可以用于此,但我无法重新定位此信息。
回答by sorin
I think I may got Xcode to build at decent speed with this command:
我想我可以用这个命令让 Xcode 以不错的速度构建:
# Xcode 3.x
defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks 4
# Xcode 4.x
defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4
This will limit the number of processes executed when it does build. Before adding this to my machine (4 cores/3GB RAM) the build process was slower than on single core!
这将限制构建时执行的进程数。在将它添加到我的机器(4 核/3GB RAM)之前,构建过程比单核慢!
I think that XCode is not able to estimate the right limit of subtasks by itself because it does the estimate by looking only at your number of cores and ignoring the amount of RAM you have.
我认为 XCode 无法自行估计子任务的正确限制,因为它仅通过查看您的内核数量并忽略您拥有的 RAM 量来进行估计。
回答by Tamer
For Xcode 4 this is now:
对于 Xcode 4,现在是:
defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4
默认写 com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4
回答by justin
Disabling code sense indexing can free considerableamounts of memory and CPU in large/complex projects, while speeding up the IDE itself.
禁用代码感索引可以释放相当数量的大型/复杂项目的内存和CPU,同时加快IDE本身。
Xcode 3
Xcode 3
Use Preferences from the app.
使用应用程序中的首选项。
Xcode 4
Xcode 4
defaults write com.apple.dt.XCode IDEIndexDisable 1
defaults write com.apple.dt.XCode IDEIndexDisable 1
回答by Paul R
Take a look at Activity Monitor and see if any other processes are taking CPU time (e.g. Spotlight or Time Machine). Also look at the System Memory tab in Activity Monitor to see whether you're paging.
查看活动监视器,看看是否有任何其他进程占用 CPU 时间(例如 Spotlight 或 Time Machine)。还要查看活动监视器中的“系统内存”选项卡以查看您是否正在分页。
回答by dodgio
I recall seeing someone recently whose Xcode speed issues were resolved by reinstalling Xcode.
我记得最近看到有人通过重新安装 Xcode 解决了 Xcode 速度问题。
If you do this, you might want to save your documentation downloads and restore them after reinstalling. It will save you from a long download. You can find the documentation files by going to Preferences / Documentation. Click the little "i" next to a Doc Set and then choose "reveal in finder" from the small window.
如果这样做,您可能希望保存文档下载并在重新安装后恢复它们。它将使您免于长时间下载。您可以通过转到首选项/文档来找到文档文件。单击 Doc Set 旁边的小“i”,然后从小窗口中选择“reveal in finder”。