Try turning on verbose gc.

Benchmarking is a difficult stuff, really. Much harder than folks usually consider it. Looking at GC, for example, you have to be aware not only of the GC type used (and its settings), but also of the machine the benchmarking is run on.

In Jason's case, if he's running 64-bit server JVM on a multi-core machine, then the JVM is using a parallel GC and is effectively running behind the scenes :)

You can also try using YouKit profiler -- it's does really good job at showing heap/ GC usage.

I am far from being an expert in JVM architecture, but I think boxed primitive types do have very special optimization at low-level and since so produce very little overhead. Also, the collections inside JDK have been optimized heavily since their initial releases. Much like reg-exes: we recently compared a code that used Pattern class and hand-crafted parsing code. The hand-crafted code was 100% faster, but much longer and more difficult to read.

Dawid

Reply via email to