XCode 在 VMWare 中编译速度非常慢

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5522577/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:43:04  来源:igfitidea点击:

XCode compiling extremely slow inside VMWare

xcodemacosvmware

提问by Hedin

The OSX 10.6.6 is installed inside VMware on Windows 7 host. The overall performance is great, However, the compiling time increased dramatically (1 hour against 2-3 min on pure MacOS). It's modern machine with Core i5 & 4GB RAM. Here are the XBench results: http://db.xbench.com/merge.xhtml?doc1=517768&doc2=1&setCookie=trueI think the problem could be in extremely slow 4k write value, but I don't know how to improve this.

OSX 10.6.6 安装在 Windows 7 主机上的 VMware 中。整体性能很好,但是,编译时间显着增加(在纯 MacOS 上为 1 小时对 2-3 分钟)。它是配备 Core i5 和 4GB RAM 的现代机器。以下是 XBench 结果:http://db.xbench.com/merge.xhtml?doc1=517768&doc2=1&setCookie=true 我认为问题可能出在极慢的 4k 写入值上,但我不知道如何改进.

Is there any way to increase performance?

有什么办法可以提高性能吗?

UPD1: swap is not used, there is enough memory for all operations the disk speed is also not related, since my another Macbook shows event worse results, and compiles hundreds times faster.

UPD1:未使用交换,有足够的内存用于所有操作,磁盘速度也不相关,因为我的另一台 Macbook 显示事件更糟的结果,并且编译速度快了数百倍。

UPD2: problem solved, see my answer below

UPD2:问题已解决,请参阅下面的答案

回答by Brynjar Gigja

Sharing experience and solution.

分享经验和解决方案。

My Xcode was running fine but when I build a project (even an empty one), it would take up to 10 minutes.

我的 Xcode 运行良好,但是当我构建一个项目(甚至是一个空项目)时,它最多需要 10 分钟。

SOLUTION:Go to Xcode -> Preference -> Source Control: Dissable Source Control

解决方案:Go to Xcode -> Preference -> Source Control: Dissable Source Control

Now projects build and run in a matter of seconds.

现在项目可以在几秒钟内构建和运行。

回答by Matthew

In VMWare, you should have a setting where you can dedicate one or two cores entirely to the virtual machine. Assuming you have quad core, maybe give MacOSX 2 or 3 cores? If you have dual-core and you've allocated 1 core to the VM (and the problem still persists), i can't say much then!

在 VMWare 中,您应该有一个设置,您可以将一个或两个内核完全专用于虚拟机。假设你有四核,也许给 MacOSX 2 或 3 核?如果您有双核并且您已经为 VM 分配了 1 个核(并且问题仍然存在),那么我不能说太多!

回答by Syed Asad Ali

It's good that your problem is solved, but I want to share my experience for improving vmware performance. Please do install VMware tools for mac os and they are present in .iso file.

很高兴您的问题解决了,但我想分享我提高 vmware 性能的经验。请为 mac os 安装 VMware 工具,它们存在于 .iso 文件中。

Steps to install VMware tools for MAC OS:

为 MAC OS 安装 VMware 工具的步骤:

1) Power on your VM.
2) At the right bottom they are some pop-up symbols(These are usually not present in full screen mode). Rightclick the CD/DVD symbol.
3) Click setting. In this window make sure that darwin.iso is selected.
4) Close this window and again right click CD/DVD symbol.
5) Click connect. An icon will appear with name darwin(300).
6) Inside this file tools are present. Install them!

1) 打开你的虚拟机。
2)在右下角,它们是一些弹出符号(这些在全屏模式下通常不存在)。右键单击 CD/DVD 符号。
3) 点击设置。在此窗口中确保选择了 darwin.iso。
4) 关闭此窗口并再次右键单击 CD/DVD 符号。
5) 点击连接。将出现一个名为 darwin(300) 的图标。
6) 在此文件中存在工具。安装它们!

回答by Anjaneyulu Battula

I also got the same problem, But i want share my personal experience here.

我也遇到了同样的问题,但我想在这里分享我的个人经验。

  1. My CPUs RAM capacity is 4 GB, So i allocated 3.5 GB to the VMWare because of this it was very slow the entire operating system.
  2. So one day i clearly observed the VMWare settings, finally found the solution. If we allocate the RAM memory more than recommended then also your operating system hangs. For my System the recommended RAM memory is 2048MB, after adjusting this now OS is fast.
  3. We can adjust the RAM memory in Devices option, inside Hardware. For clarification here i am attaching the screen shot. enter image description here
  1. 我的 CPU 的 RAM 容量为 4 GB,因此我为 VMWare 分配了 3.5 GB,因此整个操作系统的速度非常慢。
  2. 于是有一天我清楚地观察了VMWare的设置,终于找到了解决办法。如果我们分配的 RAM 内存超过推荐值,那么您的操作系统也会挂起。对于我的系统,推荐的 RAM 内存为 2048MB,调整后现在操作系统速度很快。
  3. 我们可以在硬件中的设备选项中调整 RAM 内存。为了澄清起见,我附上了屏幕截图。 在此处输入图片说明

回答by Hedin

The problem was: VERY SLOW recursive searching of include paths. If non-recursive, everything works smooth.

问题是:包含路径的递归搜索非常慢。如果是非递归的,一切都会顺利进行。

回答by mcfly soft

I had the same problem and I fixed it as follow:

我遇到了同样的问题,我按如下方式修复了它:

  1. Most boost I got with changing my vmware config file to disable memory stored in .vmem file. In my .vmx file I added :
  1. 通过更改我的 vmware 配置文件以禁用存储在 .vmem 文件中的内存,我获得了最大的提升。在我的 .vmx 文件中,我添加了:
  mainMem.useNamedFile = "FALSE"

  prefvmx.minVmMemPct = "100"
  mainMem.useNamedFile = "FALSE"

  prefvmx.minVmMemPct = "100"
  1. Setting max cores to the guest
  2. When programming with swift and XCode. Remove all comments /* */ not really used.
  1. 为来宾设置最大核心数
  2. 使用 swift 和 XCode 编程时。删除所有未真正使用的注释 /* */。