如何在 Xcode 4 中禁用索引?

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

How to disable indexing in Xcode 4?

xcodeindexingxcode4

提问by FarMiaplacidus

Not a long time ago I updated Xcode to version 4. This new version spent a lot of time on indexing the project (it's quite large). That's why I would like to disable indexing. Searching through Xcode help and internet gave no results.

不久前我将 Xcode 更新到版本 4。这个新版本在索引项目上花费了大量时间(它相当大)。这就是为什么我想禁用索引。通过 Xcode 帮助和互联网搜索没有结果。

回答by Dave

Open a terminal window and paste this command:

打开终端窗口并粘贴以下命令:

defaults write com.apple.dt.XCode IDEIndexDisable 1

You'll lose some features (autocomplete, jump to definition, some of the assistants won't work right). But you'll gain back ram and cpu.

您将失去一些功能(自动完成、跳转到定义、某些助手无法正常工作)。但是你会获得 ram 和 cpu。

For my project Xcode went from using 2 Gigs to a few hundred MB. (which I sorely needed to compile with ;))

对于我的项目,Xcode 从使用 2 Gigs 到几百 MB。(我非常需要用它来编译;))

回答by Peter Tseng

Reducing the priority of the XCode process helps:

降低 XCode 进程的优先级有助于:

renice 10 -p PID

You can get the PID from the Activity Monitor or top/ps commands.

您可以从活动监视器或 top/ps 命令获取 PID。

回答by Richard Kettering

This problem has been noticed on this newsgroup:

这个问题已经在这个新闻组上注意到了:

The crux of it seems to be that XCode4 uses crazy amounts of ram during indexing - like, 5gb or so(!), and thus if you're on a machine with something like 12gb, there's no problem, but if you're on a laptop with only 2gb or so, you'll have some pretty severe paging going on.

问题的关键似乎是 XCode4 在索引期间使用了大量的内存——比如 5GB 左右(!)只有 2gb 左右的笔记本电脑,你会遇到一些非常严重的寻呼。

I'm guessing apple's internal engineers were all rocking maxed-out mac pros or something.

我猜苹果的内部工程师都在为 mac 专业人士摇摆不定。

回答by Damian Carrillo

I ran into either the same problem or something similar. My project includes heavily templated C++. Including those headers in the PCH file solved the problem for me.

我遇到了同样的问题或类似的问题。我的项目包括大量模板化的 C++。在 PCH 文件中包含这些标题为我解决了这个问题。

回答by Jim

My new retina Macbook pro running XCode 4 was extremely slow doing indexing (and everything else). My Mac mini at home was very fast working on the same project!? Turns out it was my anti-virus software - doing a scan of every file read or written on the MacBook. Turning that off sped everything up by a ton.

我的新 Retina Macbook pro 运行 XCode 4 在索引(以及其他所有内容)时非常慢。我家里的 Mac mini 在同一个项目上工作速度非常快!?原来这是我的防病毒软件 - 扫描在 MacBook 上读取或写入的每个文件。关闭它会使一切加快一吨。

回答by dar512

Slow indexing is not a given. And more memory isn't necessarily better.

慢索引不是给定的。更多的内存并不一定更好。

I have a medium sized project for work ~ 500 source files. After deleting the derived data, it takes 18 minutes to finish reindexing this project. That's with no other apps open and not doing anything else with the computer. This is on a fairly recent Macbook Pro with 8G of memory and an i7. Horrible, right?

我有一个中等大小的工作项目 ~ 500 个源文件。删除派生数据后,完成重新索引该项目需要 18 分钟。那是没有打开其他应用程序,也没有对计算机做任何其他事情。这是在具有 8G 内存和 i7 的相当新的 Macbook Pro 上。可怕,对吧?

My home machine is a recent Mac Mini with 4G of memory and an i5. On that machine the exact same project takes 40 seconds to completely index.

我的家用机器是最近的 Mac Mini,4G 内存和 i5。在那台机器上,完全相同的项目需要 40 秒才能完全索引。

I don't yet know what the difference is, but I'm working on it.

我还不知道有什么区别,但我正在努力。

回答by Chris Hanson

It's not possible to disable indexing in Xcode 4. Many of the IDE's features are built on top of the index it maintains.

在 Xcode 4 中无法禁用索引。IDE 的许多功能都建立在它维护的索引之上。