Computer Language Shootout - concurrency

Mikael Pettersson <>
Tue Dec 6 16:45:50 CET 2005


Nic Linker writes:
 > James Hague wrote:
 > 
 > >>A fly in the ointment - the Ackermann function:
 > >>http://shootout.alioth.debian.org/gp4/benchmark.php?test=ackermann&lang=all
 > >>
 > >>Erlang HiPE - 15th place. ;-)
 > >>    
 > >>
 > >
 > >Interpreted Erlang is within 10x of the top, natively compiled
 > >benchmark.  It's ahead of GForth, which is one of the fastest
 > >interpreters out there (one that doesn't even do dynamic type checks).
 > > That's great!
 > >  
 > >
 > But Erlang HiPE is not interpreted and I found natural to compare it
 > with other compilable languages, and unfortunately Erlang is not even
 > close to the leader, in contrast of what I expected. :-(  (Why did I
 > expect it? Because recursion is the one of the strongest features of
 > functional languages).

The benchmark results on that page looked very strange,
especially the position of HiPE compared to C and BEAM,
so I re-ran the relevant ones (C, HiPE, BEAM) using more
accurate measurement technology[1]. In summary, HiPE is
about 2.5 times slower than C, with BEAM being 4.5 to 9
times slower than HiPE[2].

The HiPE code is burdened by (a) a reduction counter test
on each entry to Ack, (b) a stack overflow test on each
entry to Ack, (c) having to verify that operands are fixnums
before executing the inline code for arithmetic, (d) having
to check that the arithmetic didn't overflow, and (e) a few
suboptimal pieces of generated code (yes I looked at it).
Items (a) to (d) all disappear for C.

[1] x86 hardware performance counters used to measure the
    number of CPU clock ticks needed for Ack(3,9): costs
    for system startup and I/O of the result is excluded
[2] On a 2.4GHz dual Xeon (about 3 1/2 years old server box):
    C: 45ms, HiPE: 111ms, BEAM: 500ms
    On a 1.6GHz Mobile Athlon64 (in 32-bit mode):
    C: 45ms, HiPE: 117ms, BEAM: 1067ms

/Mikael



More information about the erlang-questions mailing list