Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Settings for Netbeans 6.8 on OSX 10.5.8 to optimize cpu usage

Sorry I have several question relative to the same problem.

I am using Netbeans 6.8 on OSX 10.5.8 with java 1.6.0_17 and after about 5 minutes of work, the cpu usage of netbeans process (and java) are around 100%.

It is often due to: - "go to declaration" command - completion command - more or less doing 2 or 3 basic actions such as entering text

I already do the following to enhance performance, without success: - specific PHP netbeans - remove all unnecessary plugin and modules

So my question is how to solve this problem and enhance java and netbeans performance on OSX?

More precisely: - will a change in garbage collection policy enhance performance? And how to do this? - will a change in default java look and feel enhance performance? Which L&F is the lightest? - how can I "backtrace" this problem more precisely?

Sorry for all this questions in the same post but I am running out of idea concerning this problem... Thank you in advance for your advices, hints and help!

like image 557
rdamon Avatar asked Feb 07 '10 15:02

rdamon


4 Answers

Thank you for the advices which lead me to play around with netbeans.conf.

here are my options that significantly improve the performances:

 -J-server
 -J-Xverify:none
 -J-d64
 -J-Xss2m
 -J-Xms256m
 -J-Xmx512m
 -J-XX:PermSize=32m
 -J-XX:MaxPermSize=512m
 -J-Dsun.java2d.noddraw=true
 -J-Dsun.java2d.opengl=true
 -J-Dsun.java2d.d3d=false
 -J-Dawt.nativeDoubleBuffering=true
 -J-XX:+UseAdaptiveSizePolicy
 -J-Djava.net.preferIPv4Stack=true
 -J-XX:+AggressiveOpts
 -J-XX:+AggressiveHeap

its seems that important ones are:
 -J-XX:+AggressiveOpts
 -J-XX:+AggressiveHeap
 -J-d64

Here are some useful links which inspired me:

  • http://java.sun.com/performance/reference/whitepapers/tuning.html#section4.2.5
  • http://performance.netbeans.org/howto/jvmswitches/index.html

I don't try 6.7 because it is now satisfying. Hope it helps!

like image 99
rdamon Avatar answered Oct 23 '22 10:10

rdamon


You could try to increase available heap for netbeans. The settings are in $NETBEANS_HOME/etc/netbeans.conf

The interessting one is netbeans_default_options Default is: -J-Xms32m I would start with -Xms256m -Xmx512m with -J (prefix)

EDIT: From netbeans.conf

If you specify the heap size (-Xmx) explicitely, you may also want to enable
# Concurrent Mark & Sweep garbage collector. In such case add the following
# options to the netbeans_default_options:
# -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled
like image 37
stacker Avatar answered Oct 23 '22 09:10

stacker


I have been using Netbeans since the 5 series, and it has always been a cpu and memory hog. I use it now only at work when I absolutely must. It doesn't handle large projects well and even on systems with fast hard drives, it still has a large amount of IO activity.

This has been on every Windows system I've used it on, XP, Vista and 7. So it isn't just you. I've also tried playing with every memory setting that I could, and disabling all of the plugins I could and it never helped.

If you can, you might want to try Eclipse. It is a lot more lightweight but getting started with different frameworks can be a bit harder since it doesn't include all of the hand holding.

like image 25
Casey Avatar answered Oct 23 '22 09:10

Casey


I found that version 7.3 (PHP build) comes with about 25 plugins, and I don't need all of them. I've been able to disable around seven of them, and CPU performance seems to die down much more quickly to idle levels now. So, if you are having CPU problems - with NB on any OS - this is probably worth a shot too.

like image 1
halfer Avatar answered Oct 23 '22 11:10

halfer