speed of simple loops: comparison to other language
Andrew Haley
aph at redhat.com
Wed Jun 30 06:24:52 PDT 2010
On 06/30/2010 12:37 PM, Steve White wrote:
> Hi,
>
> I have some questions regarding the raw computing speed of the Java VM.
>
> I've timed some simple numerical (and related) operations written in
> various languages, compiled with various compilers, on various platforms.
> They always consist of repeatedly doing some operation to a small array
> (small enough that everything fits in an L1 cache) so that the time is
> humanly sensible, and then reporting the total time.
>
> Of course, one expects loops in Java to run a bit slower than optimized
> loops in C, as it simply does more: bounds-checking etc. One surprise is
> that in these tests Java's speed is comparable to that of C code optimized
> for the platform.
>
> But there are oddities... Here's what I see:
>
> On my Intel x86_64-compatible workstation, C loops compiled with gcc
> complete in time very similar to that of Java loops, running on the
> x86_64 VM supplied by my distro.
>
> However, on IA-32 machines, using the VM of OpenJDK, the Java loops run
> about half the speed as C loops compiled with gcc.
>
> I tried building the Java VM from source for my IA-32 machine, but saw no
> improvement in performance at all from the distribution VM.
Using the "-server" option?
Andrew.
More information about the hotspot-compiler-dev
mailing list