Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the seven techniques for speeding up Eclipse?

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

What are the seven skills to speed up Eclipse? I believe many inexperienced people don't know what to do about it. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Some people have asked me how to speed up Eclipse, and this article will discuss this issue. By the way, this article is not IDE, so don't say you hate one IDE and choose another. This article only focuses on how to make Eclipse run faster. Each technique is detailed for Windows, Linux, and MacOS users. After using all the optimization techniques, Eclipse should be able to start in 10 seconds and run more smoothly than before.

These techniques not only shorten the startup time of Eclipse, but most of them also improve the user experience. For example, opening classes faster, jumping from one definition to another, viewing javadoc, and so on. But these increases cannot be accurately measured in time, so there is no specific benchmark for the speed-up effect brought about by each technique.

Tip: suppose you already have a solid state drive and have at least 8Gb memory. If not, the performance improvement may not be significant.

Tip 1: run * versions 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 using Oracle's JDK. For network development, you need to use Eclipse for Java EE instead of Eclipse for Java.

Oracle JDK: http://www.oracle.com/technetwork/java/javase/downloads

Eclipse: https://eclipse.org/downloads/

Put Eclipse and workspace on the solid state drive. Start Eclipse.

Tip 2: adjust the Preferences of Eclipse

General > Startup and Shutdown: remove all plug-ins that are loaded at startup.

General > Editors > Text Editors > Spelling: turn off spell checking.

General > Validation > check "Suspend all validator".

Window > Customize Perspective > remove all content you don't need or don't want to use (try to use shortcuts), and the same is true of 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 automatic prompts 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 as needed. This can be done through the following configuration: (translator's Note: Ctrl+Space? The Chinese will not allow it.

Java > Editor > Content Assist > disable "Enable Auto Activation". Remove all unwanted content from Advanced (not found in Eclipse 4.2.2).

Tip 3: put JDK on memory disk (RAM Disk)

Memory disk is the use of computer memory as a virtual disk or hard disk. It is used to speed up the IO performance of the software located in it. The RAM disk created in memory is like a hard disk on a computer. Because this memory is used as a hard disk, other programs cannot use it. We just put JDK there, and 300MB is enough.

Warning: do not put any content on the memory disk *. Every time you restart, the content will disappear and recreate.

For Linux users:

There is a detailed description in this link.

For Mac users:

Create a memory disk using the diskutil tool

1. Create a new script, for example: ~ / tools/batch/ramdisk.sh

Replace x, y, z with your JDK version:

#! / bin/bash diskutil erasevolume HFS+ 'JDKRAMDISK' `hdiutil attach-nomount ram:// 614400` cp-r / Library/Java/JavaVirtualMachines/jdk1.x.y_z.jdk / Volumes/JDKRAMDISK

(note: the expected parameter for diskutil is an integral multiple of the 512-byte sector: for 300MB, it should be 300 * 1024 ^ 2 / 512 = 614400)

two。 Save the script and change it to executable mode:

Chmod 755 ~ / tools/batch/ramdisk.sh

Running ramdisk.sh creates a memory disk:

$ramdisk.sh Started erase on disk4 Unmounting disk Erasing Initialized / dev/rdisk4 as a 300 MB case-insensitive HFS Plus volume Mounting disk Finished erase on disk4 JDKRAMDISK

Now using Finder should be able to find a new device called JDKRAMDISK, which contains JDK. Click the "eject" button to remove the RAM Disk and free the corresponding memory.

If you want to use this technique, you need this memory disk every time you start Eclipse, otherwise you will see a "A Java Runtime … must be available in order to run Eclipse" error. You can configure the system to use Automator or a unchtl daemon to ensure that the ramdisk.sh script is executed automatically each time you start.

For Windows users:

1. Download and install a tool called imdisk

two。 Create a new batch file, such as C:/tools/batch/ramdisk.bat

Replace x, y, z with your JDK version number:

@ echo Placing JDK on Virtual Disk vm / @ echo off sc config imdisk start= auto net start imdisk imdisk-a-t vm-s 300m-m n: format n: / Q / Y call xcopy C:jdk1.x.y_z N:jdk1.x.y_z / S / E / Y / Q label n: JDK RAMDISK

After running ramdisk.bat, you will see that a new disk N called "JDK RAMDISK" has been created, which contains JDK.

3. Make sure the file is running in administrator mode. Right-click the file, select Properties-compatibility-check run this program as administrator.

If you want to use this technique, you need this memory disk every time you start Eclipse, otherwise you will see a "A Java Runtime … must be available in order to run Eclipse" error. You can configure the system to put the ramdisk.bat script in the startup folder.

In order for Tip 3 to work, you need to add the-vm setting to the eclipse.ini file (see the next section for details).

Tip 4: adjust your eclipse.ini

In the optimization of Eclipse, this is the most confusing part. There are a large number of articles on the Internet to introduce different configuration schemes. I'm just introducing my own configuration.

Find your eclipse.ini file:

Windows/Linux: located at $ECLIPSE_HOME. (note: $ECLIPSE_HOME is the path to Eclipse. It is assumed that Linux is also installed by itself, rather than through the source installation.)

MacOS: located at $ECLIPSE_HOME/Eclipse.app/Contents/MacOS

Understand the meaning of the next job.

There are two types of properties in eclipse.ini: properties related to Eclipse applications and properties related to JVM. These options depend on the version of JDK and Eclipse. The following is a list of the * I found online.

To understand these attributes, you first need to understand the memory layout of Oracle JVM. Generally speaking, JVM memory is divided into several memory pools, and objects are located in different memory pools according to their existence time.

The Eden space (heap) is used for many newly created objects. The garbage collector typically processes "new" objects here every time and removes all objects that are no longer in use.

The Survivor space (heap) contains objects that have not been destroyed by GC two or three times in the Eden space. These objects still belong to the new generation, but by moving them to a safer place, the risk of being collected is greatly reduced. Garbage collectors run here much less frequently (GC determines that objects here are frequently used based on past experience).

The Tenured space (heap) contains objects that have lived in Survior space for quite some time.

Immortal (non-heap) contains JVM metadata, such as class properties, methods, enumerations, and so on. Because this data can be shared among multiple JVM. So the immortal generation is divided into two areas: read-only and read-write.

The code cache (non-heap) provides memory space for compiling and storing code.

If you're interested, Oracle contains a good article on configuring garbage collection that details the use of all of these spaces.

In eclipse.ini, you can control the size of each memory pool. The following configuration is set for my 16 GB of memory, but it can also be used for 8 GB of memory.

Use the JDK located in RAM Disk (using the version number in step 3):

-vm / Volumes/JDKRAMDISK/jdk1.x.y_z.jdk/Contents/Home/-vm N:/jdk1.x.y_z/bin

Disable bytecode verification (risky)

This skips the validation of class files (see here for information on validation of class files), which means that JVM does not detect the class files used. If the class file used has been modified, there is a security risk. At your own risk (I only use it when I play, and I won't turn this option on at work).

Turn on compiler performance optimization

-XX:+AggressiveOpts

Increase the immortal space (where new objects are allocated) (in JDK 8, immortal is removed)

-XX:PermSize=512m-XX:MaxPermSize=512m

Increase the space of the minimum heap (including the new generation and the old generation)

-Xms2048m-Xmx2048m

Increase the size of the heap for the new generation

-Xmn512m

Set the stack size for each thread

-Xss2m

Adjust garbage collection

-XX:+UseParallelOldGC

* here is a list of other options that you may see online. Personally, none of these options have an acceleration effect, so they are just for reference. Readers can find the appropriate documentation online 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

* remove all duplicate options, including launcher.XXMaxPermSize, because when the XX:MaxPermSize option is enabled, this option is useless.

Tip 5: turn off antivirus software

If antivirus software is available, make sure it doesn't check the code folder. Add JDK, Eclipse, your .m2 / jar code base and code folder to the whitelist of antivirus software.

Tip 6: do not run SVN and GIT in Eclipse

It's a personal preference. Some people like to combine Eclipse with team collaboration tools. Personally, it's slow, and I'd rather Eclipse focus on development than do a lot of things at once. I also like the SVN/GIT command line very much. Anyway, I removed these tools from Eclipse and found that the response was faster.

Tip 7: use the keyboard

One of the things about Eclipse is that it contains a lot of shortcut keys. Readers can set the relevant shortcut keys on their own. I usually reset the debug key so that it behaves the same as Visual Studio & Chrome Dev Env. Take some time to learn keyboard shortcuts. The more keyboard shortcuts you use, the faster you will experience using Eclipse.

There is no in-depth introduction to keyboard shortcuts here, and readers can easily find relevant information on the Internet. Here are some necessary shortcuts:

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 pretty much it. There is no comparison between Eclipse and other IDE, and I think Eclipse is a very powerful and fast Java code editing tool.

After reading the above, have you mastered the seven techniques to speed up Eclipse? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report