如何加速 Eclipse?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/316265/
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 can you speed up Eclipse?
提问by user2427
How can you make the experience with Eclipse faster?
如何更快地体验 Eclipse?
For instance: I disable all the plugins I don't need (Mylyn, Subclipse, …).
例如:我禁用了所有不需要的插件(Mylyn、Subclipse...)。
Instead of using a plugin for Mercurial, I configure TortoiseHGas an external tool.
我没有使用Mercurial插件,而是将TortoiseHG配置为外部工具。
采纳答案by VonC
The three most influential factors for Eclipse speed are:
对 Eclipse 速度影响最大的三个因素是:
- Using the latest version of Eclipse(3.4 Ganimede at the time of writing in 2008)
Note that David Bala?ic's comment(July 2014) contradicts that criteria which was working six years ago:
- 使用最新版本的 Eclipse(2008 年撰写本文时为 3.4 Ganimede)
请注意,David Bala?ic的评论(2014 年 7 月)与六年前有效的标准相矛盾:
The "same" workspace in Indigo (3.7.2) SR2 loads in 4 seconds, in Kepler SR2 (4.3.2) in 7 seconds and in Luna (4.4.0) in 10 seconds. All are Java EE bundles. Newer versions have more bundled plugins, but still the trend is obvious. (by "same" workspace I mean: same (additionally installed) plugins used, same projects checked out from version control).
Indigo (3.7.2) SR2 中的“相同”工作区在 4 秒内加载,在 Kepler SR2 (4.3.2) 中加载在 7 秒内,在 Luna (4.4.0) 中加载在 10 秒内。都是 Java EE 包。较新的版本有更多的捆绑插件,但趋势仍然很明显。(“相同”工作区我的意思是:使用相同的(额外安装的)插件,从版本控制检出相同的项目)。
Launching it with the latest JDK(1.7 at the time of writing, which does not prevent you to compile in your Eclipse project with any other JDK you want: 1.4.2, 1.5, 1.6 older...)
-vm jdk1.6.0_10\jre\bin\client\jvm.dll
Configuring the eclipse.ini(see this question for a complete eclipse.ini)
-Xms128m -Xmx384m -XX:MaxPermSize=128m _# NOTE: this option is obsolete in Java 8, it will be ignored_ -Xss2m [...]
使用最新的 JDK(在撰写本文时为 1.7,这不会阻止您在 Eclipse 项目中使用您想要的任何其他 JDK 进行编译:1.4.2、1.5、1.6 旧版...)
-vm jdk1.6.0_10\jre\bin\client\jvm.dll
配置eclipse.ini(请参阅此问题以获取完整的 eclipse.ini)
-Xms128m -Xmx384m -XX:MaxPermSize=128m _# NOTE: this option is obsolete in Java 8, it will be ignored_ -Xss2m [...]
The Xmx
argument is the amount of memory Eclipse will get (in simple terms). With -Xmx384m
, it gets 384 MB of RAM, with -Xmx4G
it gets 4 GB, etc.
该Xmx
参数是内存量Eclipse将开始(用简单的术语)。使用-Xmx384m
,它获得 384 MB 的 RAM,-Xmx4G
获得 4 GB 等。
Note:
笔记:
Referring to the jvm.dll has advantages:
- Splash screen coming up sooner.
- Eclipse.exe in the process list instead of java.exe.
- Firewalls: Eclipse wants access to the Internet instead of Java.
- Window management branding issues, especially on Windows and Mac.
But it can also have some drawbacks if you try to push the memory too high.
The default memory taken by Eclipse is the combination of MaxPermSize and Xmx. Here up to512 MB total, which is quite enough for a 1 GB memory computer.
引用 jvm.dll 有以下优点:
- 闪屏很快就会出现。
- 进程列表中的 Eclipse.exe 而不是 java.exe。
- 防火墙:Eclipse 想要访问 Internet 而不是 Java。
- 窗口管理品牌问题,尤其是在 Windows 和 Mac 上。
但是,如果您尝试将内存推得太高,它也会有一些缺点。
Eclipse 占用的默认内存是MaxPermSize 和 Xmx的组合。这里高达512 MB总,这是相当足够的1次GB内存的计算机。
回答by Assem
Add -Xverify:none
to your eclipse.inifile.
添加-Xverify:none
到您的eclipse.ini文件中。
It will cut down your Eclipse startup time considerably (50% in my case if not more). This will tell the VM not to validate all the .class files it is loading.
它会大大减少您的 Eclipse 启动时间(在我的情况下是 50%,如果不是更多的话)。这将告诉 VM 不要验证它正在加载的所有 .class 文件。
Consider this: Never Disable Bytecode Verification in a Production System(as mentioned in the comments)
考虑一下:永远不要在生产系统中禁用字节码验证(如评论中所述)
回答by Colm Ryan
Go to Windows-> Preferences-> Validationand uncheck any validators
you don't want or need.
转到Windows->首选项->验证并取消选中validators
您不需要或不需要的任何选项。
For Eclipse 3.7, you use Windows-> Preferences-> General-> Startup and Shutdown.
对于 Eclipse 3.7,您使用Windows-> Preferences-> General-> Startup and Shutdown。
回答by chromakode
Make sure that you're using the Sun JVM to run Eclipse.
确保您使用 Sun JVM 来运行 Eclipse。
On Linux, particularly Ubuntu, Eclipse is installed by default to use the open source GCJ, which has drastically poorer performance. Use update-alternatives --config java
to switch to the Sun JVM to greatly improve UI snappiness in Eclipse.
在 Linux,尤其是 Ubuntu 上,默认情况下安装 Eclipse 以使用开源 GCJ,其性能非常差。使用update-alternatives --config java
切换到了Sun JVM,大大提高了在Eclipse UI爽口感。
回答by Nrj
Close any open projects which are not in current use.
关闭当前未使用的所有打开项目。
Try to switch off the auto publish mode during development.
尝试在开发过程中关闭自动发布模式。
回答by Mateng
Thanks for the hints. These options (mentioned above) helped me a lot:
感谢您的提示。这些选项(上面提到的)对我帮助很大:
Windows:
视窗:
Increasing memory & regarding to my updated Java version in eclipse.ini:
增加内存和关于我在 eclipse.ini 中更新的 Java 版本:
-Dosgi.requiredJavaVersion=1.6
-Xms512m
-Xmx512m
-XX:PermSize=512m
-XX:MaxPermSize=512M
-Xverify:none
Additionally, since we are optimizing for speed, setting -Xms
to the same value as -Xmx
makes the JVM start with the maximum amount of memory it is allowed to use.
此外,由于我们正在优化速度,因此设置-Xms
为与-Xmx
使 JVM 以允许使用的最大内存量启动的值相同的值。
Linux / Ubuntu:
Linux / Ubuntu:
Using
使用
update-alternatives --config java
回答by ILX
Another performance boost can be gained by disabling label decorations
(Windows -> Preferences; General -> Appearance -> Label Decorations
)
and by disabling unused capabilities on startup
(Windows -> Preferences; General -> Startup and Shutdown
).
通过禁用标签修饰 ( Windows -> Preferences; General -> Appearance -> Label Decorations
) 和在启动时禁用未使用的功能( ),可以获得另一个性能提升Windows -> Preferences; General -> Startup and Shutdown
。
You may also get additional performance by choosing a different garbage collection strategy depending on your JVM.
您还可以通过根据您的 JVM 选择不同的垃圾收集策略来获得额外的性能。
If you're fed up with restart cycles you could use JavaRebelfrom ZeroTurnaround. That will shorten your time spent on server/client restarts.
如果您厌倦了重启周期,您可以使用ZeroTurnaround 中的JavaRebel。这将缩短您花在服务器/客户端重启上的时间。
回答by nos
While not directly related to Eclipse:
虽然与 Eclipse 没有直接关系:
If you're running Windows 7 (and presumably Windows Vista), be sure to disable the file indexing of your workspace folder if your stuff is is in the default place - your home folder. Windows by default indexes everything in you home folder, and it's normally just a waste for your workspace. (Right click the workspace folder in explorer , Properties-> Advanced.)
如果您运行的是 Windows 7(也可能是 Windows Vista),如果您的东西位于默认位置 - 您的主文件夹,请务必禁用工作区文件夹的文件索引。默认情况下,Windows 会为您的主文件夹中的所有内容编制索引,这通常只会浪费您的工作空间。(右键单击资源管理器中的工作区文件夹,Properties-> Advanced。)
回答by JarHead
Disable virus scanners, or at least configure any virus scanner to not scan JAR files on read access.
禁用病毒扫描程序,或至少将任何病毒扫描程序配置为在读取访问时不扫描 JAR 文件。
回答by Yoni
Eclipse loads plug-ins lazily, and most common plug-ins, like Subclipse, don't do anything if you don't use them. They don't slow Eclipse down at all during run time, and it won't help you to disable them. In fact, Mylynwas shown to reduce Eclipse's memory footprint when used correctly.
Eclipse 会延迟加载插件,大多数常见的插件,例如Subclipse,如果您不使用它们,则不会执行任何操作。它们在运行时根本不会减慢 Eclipse 的速度,也不会帮助您禁用它们。事实上,Mylyn被证明可以在正确使用时减少 Eclipse 的内存占用。
I run Eclipse with tons of plug-ins without any performance penalty at all.
我运行带有大量插件的 Eclipse,根本没有任何性能损失。
- Try disabling compiler settings that you perhaps don't need (e.g. the sub-options under "parameter is never read).
- Which version of Eclipse are you using? Older versions were known to be slow if you upgraded them over and over again, because they got their plug-ins folder inflated with duplicate plug-ins (with different versions). This is not a problem in version 3.4.
- Use working-sets. They work better than closing projects, particularly if you need to switch between sets of projects all the time.
- 尝试禁用您可能不需要的编译器设置(例如“永远不会读取参数”下的子选项)。
- 您使用的是哪个版本的 Eclipse?众所周知,如果您一遍又一遍地升级旧版本,它们会很慢,因为它们的插件文件夹会因重复的插件(不同版本)而膨胀。这在 3.4 版本中不是问题。
- 使用工作集。它们比关闭项目更有效,特别是如果您需要一直在项目组之间切换。
It's not only the memory that you need to increase with the -Xmx switch, it's also the perm gen size. I think that problem was solved in Eclipse 3.4.
这不仅是您需要使用 -Xmx 开关增加的内存,而且还是perm gen size。我认为这个问题在 Eclipse 3.4 中得到了解决。