Netbeans Performance Switches

I recently have began to use Netbeans because I’m sad that Eclipse is every time slower and it frozes every time when you are doing something to fast.

Netbeans is not perfect, and there are some features that need to be polished (Ex.: SVN Support, Time Tracking like Mylyn), but the PHP/HTML/CSS/JS Support is excellent, in my opinion better than the Eclipse PDF support.

These is my netbeans_default_options for Netbeans for MacOSX (under Windows you can leave out the –laf switch, it’s for changing the look and feel):

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Xmx512m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Xverify:none -J-XX:CompileThreshold=100 -XX:+CompressedOOPS -XX:+AggressiveOpts -XX:+TieredCompilation -XX:+DoEscapeAnalysis -XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.noddraw=true --laf javax.swing.plaf.metal.MetalLookAndFeel"

Some switches come from Netbeans Performance site.

  • -J-Xss2m – Define Stack Size (Too small and you will get StackOverflow Exceptions)
  • -J-Xms32m – This setting tells the Java virtual machine to set its initial heap size to 32 megabytes. By telling the JVM how much memory it should initially allocate for the heap, we save it growing the heap as NetBeans consumes more memory. This switch improves startup time
  • -J-Xmx512m – This settings tells the Java virtual machine the maximum amount of memory it should use for the heap. Placing a hard upper limit on this number means that the Java process cannot consume more memory than physical RAM available. This limit can be raised on systems with more memory. Current default value is 128MB. Note: Do not set this value to near or greater than the amount of physical RAM in your system or it will cause severe swapping during runtime
  • -J-XX:PermSize=32m -J-XX:MaxPermSize=200m – How much Heap can be added over the Xmx limit
  • -J-Xverify:none – This switch turns off Java bytecode verification, making classloading faster, and eliminating the need for classes to be loaded during startup solely for the purposes of verification. This switch improves startup time, and there is no reason not to use it
  • -J-XX:CompileThreshold=100 – This switch will make startup time slower, by HotSpot to compile many more methods down to native code sooner than it otherwise would. The reported result is snappier performance once the IDE is running, since more of the UI code will be compiled rather than interpreted. This value represents the number of times a method must be called before it will be compiled
  • -XX:+CompressedOOPS – Activate Compressed “Ordinary Object Pointer”
  • -XX:+AggressiveOpts – Turns on point performance optimizations that are expected to be on by default in upcoming releases
  • -XX:+TieredCompilation – Activate Tiered Compiler
  • -XX:+DoEscapeAnalysis – Activate Escape Analysis
  • -J-XX:+UseConcMarkSweepGC or -J-XX:+UseParNewGC Try these switches if you are having problems with intrusive garbage collection pauses. This switch causes the JVM to use different algorithms for major garbage collection events (also for minor collections, if run on a multiprocessor workstation), ones which do not “stop the world” for the entire garbage collection process. You should also add the line -J-XX:+CMSClassUnloadingEnabled and -J-XX:+CMSPermGenSweepingEnabled to your netbeans.conf file so that class unloading is enabled (it isn’t by default when using this collector)

3 Comments to “Netbeans Performance Switches”