112
votes

Is there a real way to get Netbeans to load and work faster?

It is too slow and gets worse when you have been coding for some time. It eats all my RAM.


I am on a Windows machine, specifically Windows Server 2008 Datacenter Edition x64, 4Gb of RAM, 3Ghz Core 2 Duo processor, etc. I am using the x64 JDK. I use the NOD32 Antivirus since for me it is the best in machine performance.

In Task Manager netbeans.exe only shows no more than 20 Mb, java.exe more than 600Mb.

My project is a J2EE web application, more than 500 classes, only the project libraries not included (externals). And when I said slow, I mean 3, 4, 5 minutes or more Netbeans is frozen.

Is my project just too large for Netbeans, if it has to read all files to get the state of files like error warnings, svn status and more? Can I disable all this? Is it possible to set it to scan only when I open a file?

My CPU use is normally at 30 percent with all my tools opened, I mean Netbeans, MS SQL Manager, Notepad, XMLSpy, Task Manager, Delphi, VirtualBox. Netbeans eats more RAM than my virtualized systems.

In Linux it is as slow as in Windows in the same machine (Ubuntu 8.04 x64).

It is true that the Netbeans team improved startup speed but when it opens it begins to cache ALL.

I have used some JVM parameters to set high memory usage and others: "C:\Program Files\NetBeans Dev\bin\netbeans.exe" -J-Xms32m -J-Xmx512m -J-Xverify:none -J-XX:+CMSClassUnloadingEnabled

But it is still slow.

30
A few questions that will help us address your issue better :-) Can you tell us how much RAM you have? What operating system? What does TaskManager show for Netbeans? How many classes does your project(s) have? When you say slow, can you give us in terms of minutes, seconds?anjanb
Your machine sounds powerful enough. It's much faster than mine and I can run netbeans at a nice speed. The only thing that springs to mind is that you're using a 64-bit OS. Are you using the 64-bit Java JDK ?s3v1
(-1) What version of Netbeans are you using, how much RAM do you have, what's your operating system, how many netbeans plugins have you installed.Andrei Ciobanu
Your machine is strong and definitely not cpu/ram limited. Modern pcs are mostly I/O limited, so you should check for your hdd parameters (queue). edit: you should edit your question instead of posting an answer.atamanroman
Do other IDEs like VS or eclipse work normally?atamanroman

30 Answers

59
votes

Very simple solution to the problem when your NetBeans or Eclipse IDE seems to be using too much memory:

  1. Disable the plugins you are not using.
  2. close the projects you are not working on.

I was facing similar problem with Netbeans 7.0 on my Linux Mint as well Ubuntu box. Netbeans was using > 700 MiB space and 50-80% CPU. Then I decided do some clean up. I had 30 plugins installed, and I was not using most of them. So, I disabled the plugins I was not using, a whopping 19 plug ins I disabled. now memory uses down to 400+ MiB and CPU uses down to 10 and at max to 50%.

Now my life is much easier.

52
votes

Don't invest time in optimizing your NB installation as long as you can scale vertically: get a SSD (and faster hardware in general).

Also:

  • Add an exception for all relevant folders (e.g. project dir, temp dir) to your anti virus software (or better, get rid of it).
  • Don't use network drives for your projects
    • check if your home drive is local
    • check if your IDE uses non-local folders (e.g. %AppData%)
24
votes
  • Download the latest Netbeans
  • Remove all the plugins you don't need.
  • Use the latest version of Java
21
votes

We can use the following JVM option to make NetBeans load/run bit faster.

JVM Option: -J-Xverify:none

  • this option tells JVM not to verify byte-code during class loading and avoids preloading unnecessary classes.

How to set:

Edit the file C:\Program Files\NetBeans <version>\etc\netbeans.conf (check your NetBeans installation folder if you installed it in another location)

  • Find the line that says

    netbeans_default_options="..."

  • Add the option -J-Xverify:none to the list of options.

  • Restart NetBeans.

15
votes

deactivate Git, Subversion, Local History, Spell checker and other unused plugins

5
votes

I use Windows 7. I suggest right-clicking the NetBeans shortcut, go to Properties, and on the Shortcut tab at the Target, add -J-Xmx1024m -J-Xms256m.

This sets the memory usage of the JVM. Xms is the minimal value, while Xmx is the max.

This is the value of target textfield:

"C:\Program Files\NetBeans 7.1\bin\netbeans.exe" --jdkhome "C:\Program Files\Java\jdk1.6.0_10" -J-Dorg.netbeans.modules.php.dbgp.level=400 -J-Xmx1024m -J-Xms256m

Since I add that attribute, my NetBeans run so fast!

Another way to try More Reference Here

In the etc directory under your Netbeans-Home, edit the file netbeans.conf file. -Xms and -Xmx should be increased to the values that allow your program to compile.

instructions in netbeans.conf :

# Note that default -Xmx and -XX:MaxPermSize are selected for you automatically.
# You can find these values in var/log/messages.log file in your userdir.
# The automatically selected value can be overridden by specifying -J-Xmx or
# -J-XX:MaxPermSize= here or on the command line.

Put the values in the netbeans_default_options string. Example :

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true  -J-Dsun.awt.disableMixing=true -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd --laf Nimbus"

What to do to speed up / free up memory windows:

  1. Disable Windows Update :

    • Open Task Manager, open tab Services, disable Windows Update:

disable win update

  1. Hit Ctrl + R and type Services.msc and press enter.
    • Sort by Startup Type
    • Select Services from 3rd party (non windows) which run Automatic, Right click, click Properties and change startup type to Manual

services

  • Sort by Status and Stop services from (3rd party) app you think unused
4
votes

Is it a corporate Windows machine? If so aggressive virus scanners can really slow down modern IDEs. Check your task manager for processes that are using a lot of CPU or disk reads.

4
votes

Everyone should note that Sun's Java Virtual Machine for Windows does not use shared memory. This means that the more heap you give to your VM, the more memory it keeps to itself. The advantage of more heap is less garbage-collection, and perhaps faster performance of the Java application you're running, but the downside is that your other applications may have less memory to work with, and your system may feel slower due to this.

3
votes

Also defragment your disk. Netbeans is very aggressive about creating caches of one form or another. Most of them get persisted to disk at some point or another which can affect startup time. Virus scanners (Symantec in particular), Desktop search engines, and any other intrusive I/O product can drastically reduce performance.

I have noticed that Netbeans can be tempermental at times and its performance can vary greatly between two machines with nearly identical specs. My work machine has terrible performance and is unusable at times, but it's lightning fast when I use it on my home machine (with bigger projects in many cases).

3
votes

Here are my netbeans options for etc/netbeans.conf using G1 GC and some other improvements.

netbeans_default_options="-J-server -J-Xss4m -J-Xms256m -J-Xmx512m -J-XX:PermSize=256m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Xverify:none -J-XX:+UseG1GC -J-XX:+TieredCompilation -J-XX:+AggressiveOpts -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd -J-Dorg.netbeans.editor.aa.extra.hints=true"

The font settings (swing.aatex and following) are optional - set as you need or remove.

Those settings are boosting my netbeans a lot!

3
votes

I've decided to research for last time why my NetBeans was running slow.

I am running PC with 16GB ram and 3.5GHz 8 Core Processor. My CPU usage is around 5-20%, memory is below 40% yet NetBeans is slower than my 15-year-old PC that I have stashed in the garage.

After finding this topic and going through http://wiki.netbeans.org/FaqSlowNetBeans I have realised that in the bottom right corner of the NetBeans I keep seeing a bar that states "Scanning...", after trying to stop it and nothing happening I have looked further at what "Scanning..." was doing and I have realised:

Each time I start the NetBeans, the NetBeans will automatically scan any open projects.

And here it is, I've closed 20 opened projects and NetBeans runs as fast as Notepad.

2
votes

If its on a corporate machine - make sure that the caches aren't stored on the network

2
votes

In order to improve Netbeans startup and build times one should (in this order):

  1. Make sure that one has enough free RAM memory (4GB Windows is enough on my 64-bit system)
  2. Buy an SSD, it makes all the difference in startup time and build time (my project build time wend from 60 seconds to 6 seconds!)
  3. Watch out for the virus scanner, they can slow down random file access considerably (make sure they don’t scan your .java and .class files!)
  4. Buy the fastest processor you can get your hands on.
2
votes

I had the same problem with Netbeans being so slow, but it is now much better after deactivating the SVN plug-in. I think that may help.

Good luck

2
votes

This works for me:

netbeans_default_options="-J-client -J-Xverify:none -J-Xmx1024m -J-Xss2m -J-Xms256m -J-XX:PermSize=32m -J-Dnetbeans.logger.console=true -J-ea -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dplugin.manager.check.updates=false -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes"

Settings in the etc/netbeans.conf.

2
votes

Really useful article about reasons why your NetBeans is slow:

http://wiki.netbeans.org/FaqSlowNetBeans

2
votes

A more or less detailed description, why NetBeans if slow so often can be found in the article:

Boost your NetBeans performance

First. check what NetBeans is actually doing on your disk. On a Mac you can issue this command:

  sudo fs_usage | grep /path/to/workspace

In my special case I got a directory which didn't exist any longer, but NetBeans tries to access the folder all the time:

  14:08:05 getattrlist /path/to/workspaces/pii 0.000011 java

Repeated many, many, many times. If you have a similar problem, fix it by deleting your NetBeans cache folder here:

   ~/.netbeans/6.8/var/cache

If your NetBeans.app is still making a lot of disk I/O. Check if it's accessing the subverison folders and svncache.

I had to disable the subversion features with config file:

  ~/.netbeans/VERSION/config/Preferences/org/netbeans/modules/versioning.properties 

add a line:

  unversionedFolders=FULL_PATH_TO_PROJECT_FOLDER  

SOURCE: Netbeans forums

IMHO it's mainly related to a lot of disk I/O caused by missing files or folders and svncache.

2
votes

Put your .netbeans Homefolder into a Ramdisk and Netbeans its going to be incredible fast.

I detected on my Ubuntu 16.04 that every Key-Press causes a HDD read or write action. Reason enougth for me to use a Ramdisk. As a little positive side-effect my HDD is quite now (no tickclickrrickrrrticktick any more) and has a longer live.

1
votes

Similar to the suggestion to put everything on an SSD.

I run netbeans from freeBSD. The netbeans cache files were in my home directory in .netbeans. My home directory was mounted over nfs so access was very slow. Moving .netbeans to the local machine greatly improved performance. I added a softlink from .netbeans in my home directory to the local directory. Netbeans describes how to change the usedir and cachedir here and lists this as a reason under item 4.

Prior to this I could write entire sentences in comments before the gui caught up and displayed them. After text appears as I type.

1
votes

Simplest solution:

Go to Preferences->Editor and Disable: Auto Popup Completion Window

Use: Meta key + \ instead when you need code completion.

The biggest problem I found was the auto code completion feature. As I typed, it kept on trying to run code completion the whole time. This was causing really slow performance since my project has a lot of libraries that it depends upon.

The best thing of all is you can stop fighting the editor as it keeps picking up false positives in the completion popup.

Have not looked back since I switched this off.

1
votes

NetBeans 8.0.2 (PHP) has two problems: the SubVersion client and the Twig templates. In order to drastically improve overall performance, a) disable teh "Twig Templates" plugin (this will also deactivate Symphony2, in case you may require it) and b) override the SVN client with this switch:

run.args.extra=-J-DsvnClientAdapterFactory=commandline

^ project.properties lets one define the CLI arguments individually (which may also make sense with RAM settings and other customization). guess one could re-enable Twig once that linked bug-report has been closed. re-scanning isn't really the issue, while the rescan performs as it should ...in a timely manner.

Just was testing some more and noticed, that on Linux it runs way smoother with the Oracle JDK than the (common) OpenJDK - have seen there is even one version of NetBeans bundled with it.

0
votes

Had the same issue with Netbeans 7.3.* and 7.4 Beta on Windows 7. Switching some plugins on and off, I figured out it was the svn plugin which boosted the CPU constantly to about 27%, converting my laptop into a toaster. Turn it off and code happy again :)

0
votes

For Windows - Should work for other OS as well

Netbeans is just like any other java application which requires tuning for its JVM.

Please read the following link to have some benchmark results for netbeans

https://performance.netbeans.org/reports/gc/

The following settings works fine in my Windows 7 PC with 4GB RAM and I5 Quad core processor.

(Check for the line netbeans_default_options in the netbeans config file inside bin folder and replace the config line as follows)

netbeans_default_options="-XX:TargetSurvivorRatio=1 -Xverify:none -XX:PermSize=100M -Xmx500m -Xms500m -XX+UseParallelGC ${netbeans_default_options}"

Small Suggestion: Garbage collection plays a vital part in JVM heap size and since I had a quad core processor, I used Parallel GC. If you have single thread processor, please use UseSerialGC. From my experience, if Xmx Xms values are same, there is no performance overhead for JVM to switch between min and max values. In my case, whenever my app size tries to exceed 500MB, the parallel GC comes in handy to cleanup unwanted garbage so my app never exceed 500MB in my PC.

0
votes

For me worked out to enable auto-scanning of sources.

0
votes

I had big problems with NetBeans 8.0.2. It's an old question but perhaps somebody else will end up here like me with the same problem, and I found no answer that helped me anywhere.

I have NetBeans 8.0.2 with Ruby on Rails plugin, on Windows 7. The IDE was hanging up to 10 seconds on almost every change I did in some files. It was problem only with big files, but it must depend on more than that, there were other big files without the problem.

The problem was caused by the "hint" "Rails 3 Deprecations", I turned it off and now it's very fast, I can have everything else turned on without problems.
It's under Tools -> Options -> Editor -> Hints.

There is also some suggestions in the other answers of optimizing with startup parameters. I found these links about JVM-switches that helped me when testing to optimize (but it turned out that these settings have nothing to do with my problem), they are very old but have some useful information:
Explanation of JVM-switches.
Some (old) recommendations

0
votes

Open the file:

/Applications/NetBeans/NetBeans\ 8.0.2.app/Contents/Resources/NetBeans/etc/netbeans.conf

I added some options shown below:

netbeans_default_options="-J-Dsun.java2d.opengl=true -J-Dsun.java2d.d3d=false -J-Xmx2048m ...

Using opengl may help you, depending on your system. I am running OsX. 2048m may be too much, but does not seem to hurt :-) ...

0
votes

Try to profile Netbeans using VisualVM. If the "hot spot" is org.gnome.accessibility.atkwrapper.emitsignal(), try to run Netbeans with

-J-Djavax.accessibility.assistive_technologies=" "

It helped a lot in my case.

I don't really know why exactly this toolkit used, but looks like it's generally safe to disable it.

0
votes

Close all the instences you have running. You might not have closed any of them in a while causing them to stack up and run in the background. Therefore causing lag/making the program work slower.

0
votes

In my case, I got a huge performance advantage by disabling Rainbow (it's a plugin that is used to color brackets in the code):

Tools -> Options -> Miscellaneous -> Rainbow (uncheck enabled)

Tested on Netbeans 10 with Java 8.

The problem of serious slowdowns occurred exclusively with particularly large Java files (more than 5000 lines of code), while there was no problem with smaller files (within 1000 or 2000 lines of code).

I made other optimizations, but this one was the most relevant, because it drastically reduced the amount of CPU used.

-1
votes

Verify if your project folder has a folder that contains files of your framework, or libraries (Ex.: The Laravel has a folder vendor) - files that you not use directly. Click on your "project" > properties. In left side, select "ignore folders" (I don't no how is in english, but is before 'Frameworks'). In right side, click on "add folder", chose de folders - this will make your Netbeans 8 faster. It works for me.