views:

989

answers:

5

Hello, 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!

+1  A: 

Does netbeans 6.7.1 show the same behaviour?

Thorbjørn Ravn Andersen
+2  A: 

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
stacker
A: 

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.

Casey
A: 

As you are using Mac OS X, you might try /Applications/Utilities/Activity Monitor.app or /Developer/Applications/Performance Tools/Thread Viewer.app to see what is impacting performance.

trashgod
+1  A: 

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 usefull links which inspired me:
http://blogs.sun.com/watt/resource/jvm-options-list.html
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. I notify in one week if it is definitly a good configuration.

Hope it helps! I try eclipse but it is kind of scary...

rdamon
+1 for sharing your experimental data, which reflects well on stacker's excellent suggestion. I see you accepted it, and I would encourage you to upvote it, too.
trashgod