Eclipse start optimization, finally not so card!

Source: Internet
Author: User
Tags xms

Eclipse start optimization, finally not so card!

Online to find a lot of myeclipse optimization, with Eclipse a little difference, find a lot of methods or can not let this eclipse (Version:kepler Release) fast up, too much trouble, and finally to find a very useful method, turn.

Start by understanding some of the related concepts in the JVM:
Xms: Minimum heap size
XMX: Maximum Heap Size
XMN: Young generation Heap Size
XSS: The heap size per thread
PermSize: initial persistent generation size
MaxPermSize: Maximum persistent generation size
The general XMS, XMX settings are the same, permsize, maxpermsize settings are the same, so as to avoid the scale heap size of performance loss.

First open the Eclipse.ini in the Eclipse installation root, plus the configuration:

Help
123 -Xloggc:gc.log-XX:+PrintGCTimeStamps-XX:+PrintGCDetails

The goal is to run eclipse with a verbose GC process.

Start eclipse, and then open Gc.log. Once you've started, you've done GC dozens of times, including many times full GC, and started optimizing ...

Solve the full GC problem first:

Help
12 3.159: [Full GC 3.159: [Tenured: 22716K->26133K(35780K), 0.1116536 secs] 38493K->26133K(51908K), [Perm : 20479K->20479K(20480K)], 0.1117614 secs] [Times: user=0.11 sys=0.00, real=0.11 secs]3.706: [Full GC 3.706: [Tenured: 26133K->27935K(43556K), 0.1235449 secs] 40042K->27935K(63204K), [Perm : 24575K->24575K(24576K)], 0.1236474 secs] [Times: user=0.13 sys=0.00, real=0.13 secs]

As can be seen on the GC log, the full GC is mainly for the tenured, Perm District GC, good that first adjust the perm size, specify a sufficient amount of persistent generation area, Eclipse.ini added:

Help
12 -XX:PermSize=128m-XX:MaxPermSize=128m

Start again see Gc.log,full GC is gone, but there are many more common GC, which still need further optimization.
Eclipse's initial heap size is allocated very small and therefore not conducive to the allocation of the young generation heap size, if the set of young generation heap size xmn is greater than the minimum heap size xms,eclipse will fail to start.
Therefore, the XMS is adjusted to 512m and the GC is significantly reduced after restarting.
Finally adjust the xmn, the young generation heap size, after repeated comparisons, found that the setting "-xmn256m" effect is optimal.
Optimized GC logs:

Help
12 3.203: [GC 3.204: [DefNew: 209776K->26176K(235968K), 0.0876304 secs] 209776K->27184K(498112K), 0.0876921 secs] [Times: user=0.09 sys=0.00, real=0.09 secs]5.422: [GC 5.422: [DefNew: 235968K->12433K(235968K), 0.0989335 secs] 236976K->39296K(498112K), 0.0990229 secs]

In nearly 6 seconds of start-up time, Eclipse has only done 2 ordinary GC recovery, how effective it is!
In general, when you do not set up eclipse, the use of eclipse will always feel that the boot is slow, good card, in fact, as long as the relevant parameters of eclipse configuration, there will be a great improvement.
Faster start-up speed
1. When eclipse starts, it always searches for the JRE it runs on, often the search process slows eclipse startup. (When not set, wait for the 2-3s to appear the progress bar, after set up directly appears the progress bar)

Just add the-VM parameter to the Eclipse.ini.

2. Cancel all plug-ins to be activated at startup (same as when activation occurs) and other related actions that are performed at startup.

3. Turn off Automatic Updates

Reduce problems with Eclipse cards caused by JVM memory reclamation
This is mainly the JVM in the client mode, when the memory is collected, will stop all the other work, with the recovery to perform other tasks, during which eclipse is stuck. Therefore, the proper increase in the amount of memory requested by the JVM to reduce the number of times it is recycled or even not recycled, there will be a noticeable improvement in the card phenomenon.

The heap memory is set primarily by the following JVM parameters:

-xmx512m Maximum total heap memory, typically set to 1/4 of physical memory
-xms512m The initial total heap memory, which generally sets it as large as the maximum heap memory, so that the heap size does not need to be adjusted based on the current heap usage
-xmn192m Young with heap of memory, Sun is officially recommended for the entire heap of 3/8
Composition of heap memory Total heap memory = Young with heap memory + aged with heap memory + persistent heap memory
Young with heap of memory When the object was just created, put it here.
Old age with heap of memory Objects are placed here before they are actually recycled.
Persistent with heap memory class file, meta-data, etc.
-xx:permsize=128m Initial size of the persistent heap
-xx:maxpermsize=128m Maximum size of the persistent heap, eclipse defaults to 256m. If you want to compile this kind of JDK, make sure to set this up very large, because it has too many classes.

My configuration (2g memory for Notebooks):

There are other relevant parameters to look at the following reference material, very inspiring:
-XX:+USEPARALLELGC using concurrent Memory reclamation
-XX:+DISABLEEXPLICITGC Disabling display memory recycling for System.GC ()

Eclipse-related settings to reduce card behavior
1. Turn off automatic builds. When enabled, eclipse will automatically build the entire project for us every time you save it, so that for large projects, it will cause a lot of cards for each save. In fact, auto-build is completely unnecessary, as long as it is OK to build once before running, Eclipse will be built for us automatically before running, so shutting down is the smartest choice.

2. Turn off spell check settings

reference materials
JVM Startup Parameters Daquan: http://www.blogjava.net/midstr/archive/2008/09/21/230265.html
Some knowledge of the JVM structure (the composition of the heap): Http://hllvm.group.iteye.com/group/wiki/2905-JVM
JVM Heap Knowledge: http://ruijf.iteye.com/blog/1028455
Eclipse Startup tuning: http://www.iteye.com/topic/756538
Eclipse comes with Help contents (search for "Running Eclipse" to find boot-related configuration)

This article goes from:

http://blog.csdn.net/tomato8524/article/details/7428742

http://blog.csdn.net/tomato8524/article/details/7428793

Eclipse start optimization, finally not so card!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.