Tip One: Run the latest version of JDK and Eclipse
In general, new versions of JDK and Eclipse will have performance optimizations. Make sure you are using 64-bit Eclipse and use Oracle's JDK. For network development, you need to use Eclipse for Java EE instead of Eclipse for Java.
Place Eclipse and workspace on your SSD. Start Eclipse.
tip Two: Adjust Eclipse's preferences
General > Startup and Shutdown: Removes all plugins loaded at startup.
General > Editors > Text Editors > Spelling: Turn off spell checking.
General > Validation > Tick "Suspend all validator". (The effect is obvious after this setting!) )
Window > Customize Perspective > Remove all content you don't use or want (use shortcut keys as much as possible), as well as the menu bar (how many times have you used the Print button on the menu bar?). )。
Install/update > Automatic Updates > Uncheck "Automatically find new Updates and notify Me".
General > Appearance > Uncheck "Enable animations".
Use the default theme. Other topics may slow down.
I also turned off the automatic prompt myself so that I wouldn't be dragged down when I entered the code. The alternative is to use Ctrl+space to use manual prompts when needed. This can be done through the following configuration.
Tip 3: Place the JDK on the memory disk (RAM disk)
The memory disk is used as a virtual disk or as a hard disk for the computer's memory. Used to speed up the IO performance of the software located therein. The RAM disk created in memory is like a hard disk on a computer. Because these memory is used as a hard disk, other programs will not be able to use these memory spaces. We just put the JDK there, and 300MB is enough.
Warning: Do not put any content permanently in the memory disk, each time you restart, the contents will disappear and re-create.
For Linux users:
This link is described in detail.
For Mac Users:
Create a memory disk using the Diskutil tool
Create a new script , for example: ~/tools/batch/ramdisk.sh
Replace the x, Y, and Z with your JDK version:
#!/bin/bashdiskutil erasevolume hfs+ ' JDK RAMDISK ' hdiutil attach-nomount ram://614400 ' Cp-r/library/java/ Javavirtualmachines/jdk1.x.y_z.jdk/volumes/jdkramdisk
(Note: The Diskutil expected parameter is an integer multiple of the 512-byte sector: For 300MB, it should be 300 * 1024 ^ 2/512 = 614400)
2. Save the script and change it to executable mode :
chmod 755 ~/tools/batch/ramdisk.sh
Running ramdisk.sh will create a memory disk:
$ ramdisk.shstarted Erase on disk4unmounting diskerasinginitialized/dev/rdisk4 as a MB case-insensitive HFS Plus Volu Memounting diskfinished Erase on Disk4 jdkramdisk
Now the Finder should be able to find a new device called Jdkramdisk, which contains the JDK. Click the "Eject" button to remove the RAM disk and release the appropriate memory.
If you want to use this technique, you need to have this memory disk every time you start Eclipse, or you will see "A Java Runtime ... must be available in order to run Eclipse" error. You can configure your system to use Automator or a UNCHTL daemon to ensure that ramdisk.sh scripts are executed automatically each time you start.
For Windows users:
Download and install the tool named ImDisk
2. Create a new batch file , such as: C:/tools/batch/ramdisk.bat
Replace the x, Y, and Z with your JDK version number:
@echo placing JDK on Virtual Disk n:/@echo OFFSC config imdisk start= autonet start imdiskimdisk-a-t vm-s 300m-m n:for Mat N:/q/ycall xcopy c:<path_jdk>jdk1.x.y_z n:jdk1.x.y_z/s/e/y/qlabel n:jdk RAMDISK
After running Ramdisk.bat, you will see that a new disk called "JDK RAMDISK" is created, containing the JDK.
3. Make sure the files are running in Administrator mode. Right-click the file and select "Properties--compatibility-check" Run this program as Administrator.
If you want to use this technique, you need to have this memory disk every time you start Eclipse, or you will see "A Java Runtime ... must be available in order to run Eclipse" error. You can configure the system to place the Ramdisk.bat script in the Startup folder.
In order for skill 3 to work, you need to add the-VM setting in the Eclipse.ini file (see the next section).
Tip 4: Adjust your Eclipse.ini
This is the most confusing part of Eclipse's optimization. There are a lot of articles on the Internet to introduce different configuration schemes. I'm just introducing my own configuration scheme.
Find your Eclipse.ini file:
Windows/linux: Located in $eclipse_home (Translator Note: $ECLIPSE _home is the path to ECLIPSE, assuming Linux is also installed on its own, rather than through a source installation)
MacOS: Located in $eclipse_home/eclipse.app/contents/macos
Understand the meaning of the next work ...
There are two types of properties in Eclipse.ini: Properties related to the Eclipse app, and JVM-related properties. These options depend on the version of JDK and Eclipse. Below is the latest list I found on the web.
To understand these properties, first understand the memory layout of the Oracle JVM. In general, JVM memory is divided into several memory pools, and objects are located in different memory pools depending on the time of their existence.
The Eden Space (heap) is used for many objects that have just been created. Garbage collector each trip is typically handled here with the "New Generation" object, and all objects that are no longer used are removed.
The Survivor Space (heap) contains objects that were not destroyed by GC two or three trips in Eden space. These objects still belong to the new generation, but move them to a more secure place, and the risk of being collected is greatly reduced. The garbage collector runs much less frequently here (the GC has judged that the objects here are often used, based on past experience).
The tenured space (heap) contains objects that have survived for quite some time in the Survior space.
Immortality (non-heap) contains the metadata of the JVM, such as class properties, methods, enumerations, and so on. Because this data can be shared among multiple JVMs. So the immortal generation reads and reads only two regions.
The code cache (not the heap) provides the memory space for compiling and storing code.
If you're interested in this, Oracle has a great article on configuring garbage collection, which details the purpose of all of these spaces.
In Eclipse.ini, you can control the size of each memory pool. The following configuration is set for my 16G memory, but can also be used for 8G of memory.
Use the JDK located in RAM disk (using the version number in step three):
-VM/VOLUMES/JDKRAMDISK/JDK1.X.Y_Z.JDK/CONTENTS/HOME/-VM N:/jdk1.x.y_z/bin
Disable bytecode verification (risky)
This is to skip the validation of the class file (see here for the validation of the class file), meaning that the JVM does not detect the class file being used. If you use a class file that has been modified, there is a security risk. Take the risk yourself (I just use it when I play, and not enable it at work).
- Turn on compiler performance optimizations
-xx:+aggressiveopts
- Increase the space of eternal life (the place where new objects are allocated) (translator Note: In JDK 8, the Life Generation was canceled)
-xx:permsize=512m-xx:maxpermsize=512m
- Increase the minimum maximum heap space (including Cenozoic and older generations)
-xms2048m-xmx2048m
- Increase the size of the heap for the Cenozoic
-xmn512m
- Set the stack size for each thread
-xss2m
- Adjust garbage collection
-xx:+useparalleloldgc
Finally, here are a list of other options that you might see online. As far as I am concerned, these options are not accelerated, so they are for reference only. Readers can find the appropriate documentation on the Web to understand and use the corresponding options:
-xx:maxgcpausemillis=10-xx:+useg1gc-xx:compilethreshold=5-xx:maxgcpausemillis=10-xx:maxheapfreeratio=70-xx:+ Cmsincrementalpacing-xx:+usefastaccessormethods-server
Finally, remove all duplicate options, including launcher. Xxmaxpermsize, this option is useless because the xx:maxpermsize option is enabled.
Tip 5: Turn off antivirus software
If you have antivirus software, make sure that the software does not check the code folder. Add JDK, Eclipse, your. M2/jar code base, and code folders to the whitelist of your antivirus software.
Tip 6: Don't run svn and git in Eclipse
This is a personal preference. Some people like to combine eclipse with team collaboration tools. As far as I'm concerned, this is slow, and I'd rather eclipse focus on development rather than doing a lot of things at once. I also like the svn/git command line very much. Anyway, I removed the tools from eclipse and found that the response was faster.
Tip 7: Use the keyboard
A bit of Eclipse is that it contains a lot of shortcut keys. The reader can set the relevant shortcut keys on its own. In general I'll reset the debug keys so that it behaves the same as Visual Studio & Chrome Dev env. Take the time to learn the shortcut keys. The more shortcut keys you use, the faster you'll experience using Eclipse.
The shortcut keys are not introduced in depth, and readers can easily find relevant information on the Web. Some of the necessary shortcuts are listed below:
Ctrl+Shift+R : jump to resource
Ctrl+Shift+T : jump to
class
Ctrl+. : jump to next error
Ctrl+Shift+G : search
for
references
Ctrl+Shift+P : select matching bracket
Alt+Arrows : go forward / backwards
Ctrl+Space : autocomplete
Ctrl+Shift+F : format source
Ctrl+Shift+O : organize imports
Ctrl+D : delete line
……
That's almost it. There is no comparison between Eclipse and other Ides, and I think Eclipse is a very powerful and fast Java code editing tool.
If you have other tricks, please let me know.
Original link: Nicolasbize translation: importnew.com-Sun Poxiang
Link: http://www.importnew.com/13942.html
7 Tips for accelerating eclipse