Eclipse索引-各种选项有什么作用 [英] Eclipse indexing - what do the various options do

查看:147
本文介绍了Eclipse索引-各种选项有什么作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您右键单击>索引在项目上有几种选择:

When you right-click > index on a project there are a few options:


  1. 重建

  2. 刷新所有文件

  3. 使用已修改的文件更新

  4. 重新解析未解析的包含文件

  1. Rebuild
  2. Freshen All Files
  3. Update with Modified Files
  4. Re-resolve Unresolved Includes

我每次都在进行重建,但是现在我正在做一个大项目,而且做不起。修改文件时,无论是.cpp还是.h,我都需要知道要执行哪个索引操作。

I've been just hitting rebuild everytime but now I'm working on a huge project and can't afford to do that; when I modify a file, whether it's a .cpp or .h, I need to know which 'index' operation to do.

对于每个索引选项:


  1. 精确地是做什么的?

  2. 什么是成本(相对内存,CPU时间)?

  1. What does it precisely do?
  2. What is the cost (relative memory, CPU time)?

Eclipse提供的文档会有所帮助,但已经进行了搜索,但没有找到任何内容。 p>

Documentation from Eclipse would be helpful but already searched and didn't find any.

推荐答案

重建只能在整个项目上执行。

Rebuild can only be performed on the whole project. It throws away the project's entire index and rebuilds it from scratch, indexing each file in the project.

由于它首先丢弃了先前的索引,因此取消了Rebuild,将导致废弃整个项目的索引并从头开始重建它,为项目中的每个文件建立索引。

Since it starts by throwing away the previous index, cancelling a Rebuild will result in an empty or partially built index.

其他操作既可以在整个项目中执行,也可以在文件夹中执行或项目中的文件(或一组文件夹/文件)。

The other actions can be performed either on the whole project, or on a folder or file (or group of folders/files) in the project.

它们都遍历所选内容中的文件,并更新索引中的部分或全部。与Rebuild不同,它们不是从清除索引开始,因此取消它们是相对安全的。

They all go through the files in the selection, and update some or all of them in the index. Unlike Rebuild, they do not start by clearing the index, so cancelling them is relatively safe.

刷新所有文件会更新所选内容中的所有文件。 。如果在项目上调用,则最终结果与Rebuild相当。

Freshen All Files updates all files in the selection. If called on the project, the end result is comparable to Rebuild.

使用修改后的文件更新仅更新选择中已更改的那些文件自上次根据索引和内容的哈希值确定索引以来的更新。

Update with Modified Files only updates those files in the selection which have changed since the last time they were updated in the index, as determined by their timestamp and a hash of their contents.

重新解析未解析的包含内容仅更新所选内容中配置信息(例如指定的包含路径)已更改的那些文件,并且更改导致以前未解决的包含现在已解决。

Re-Resolve Unresolved Includes only updates those files in the selection for which configuration info (such as specified include paths) has changed, and the change resulted in an include that was previously unresolved now being resolved.

根据项目规模和运行机器的类型,性能特征可能会有很大差异。我正在做一个非常大的项目(数百万行),在相对较新的桌面上,重建可能需要20-30分钟。该操作通常受CPU限制,但是索引器当前是单线程的,因此它只会用完一个CPU内核。

The performance characteristics can vary a lot depending on the project size and the kind of machine you're running on. I work on a very large project (millions of lines) for which a Rebuild can take 20-30 minutes on a relatively modern desktop. The operation is typically CPU-bound, but the indexer is currently single-threaded, so it will only use up one CPU core.

最后,我想再说一遍我在问题上的评论:如果您将索引配置为在首选项中自动更新。 C / C ++ | Indexer ,至少从理论上讲,您根本不需要手动调用这些命令。实际上,我发现偶尔需要重建(每隔几周一次),尤其是在更改配置(例如添加新的包含路径)之后。

Finally, I'd like to mention again what I said in my comment on the question: if you configure the index to be updated automatically in Preferences | C/C++ | Indexer, you shouldn't need to manually invoke these commands at all, at least in theory. In practice, I find an occasional Rebuild is necessary (say once every few weeks), especially after a configuration change (e.g. adding a new include path).

来源:this 通过邮件发送列表帖子,阅读操作的执行情况,以及使用CDT的经验。

Sources: this mailing list post, reading the implementation of the actions, and experience using CDT.

这篇关于Eclipse索引-各种选项有什么作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆