On Tue, Mar 24, 2009 at 7:23 AM, David Hall <
dlwh@...> wrote:
> Second observation, your benchmarking (below) is the "wrong" way to
> benchmark JVM code because of the peculiarities of hotspot. You should
> wrap these calls in a method and call it at least 10,000 times in a
> method before clocking speeds. HotSpot can do amazing things when you
> give it a chance.
>
> That said, my understanding* is that HotSpot does not (yet**) do a
> great job removing object creations, which is what is needed to really
> make implicits faster.
Right, see
http://wikis.sun.com/display/HotSpotInternals/MicroBenchmarksfor some tips how to fix microbenchmarks with the Hotspot compiler of
the OpenJDK. You can use -XX:+PrintCompilation VM option (with OpenJDK
or Sun JVM) to see when methods get JIT-compiled. In this particular
case my tries showed, that the method is compiled just after (while?)
the first run, so doing 10 iterations of the whole method should
suffice.
Johannes
-----------------------------------------------
Johannes Rudolph
http://virtual-void.net