... and if you're running on a Server Java VM,
java –XX:+UseSerialGC -XX:NewSize=100M
Explanation. HotSpot (1.5 and 1.6) has three garbage collectors:
- a serial collector (default on client VMs)
- a threaded (parallel) collector (default on server VMs)
- a low-latency collector for real-time apps where pausing is bad
I'm finding the serial collector to be faster on OS X.
To force the serial collector, use –XX:+UseSerialGC
To force the parallel collector, use –XX:+UseParallelGC
Hotspot keeps newly-created objects in a nursery before moving them
to an "older object" region. ECJ makes LOTS of new objects,
particularly if you're doing GP. Having that nursery be large is
quite helpful. I've found that on Artificial Ant, for example, you
can double your speed almost with -XX:NewSize=100M
You can get away with 50M and only have a slight degradation. Things
start really dropping speedwise at around 40M.
Your mileage may vary. Anyone got different results?