[erlang-questions] STM

Ulf Wiger ulf.wiger@REDACTED
Thu Mar 5 09:43:51 CET 2009


Tony Arcieri wrote:
> And as a more general question, how could Erlang improve its
> performance on problems like chameneos-redux?
> 
> http://shootout.alioth.debian.org/u32q/benchmark.php?test=chameneosredux&lang=hipe&id=1
> 
> This is a benchmark where Erlang's poor performance sticks out like a
> sore thumb.  The frontrunners (on the quad-core benchmark) are
> Haskell, C++, Scala, C, and Java.  Erlang comes in dead last.

Interestingly, when I gave a presentation at DAMP*
in February, and mentioned this benchmark particularly,
Simon Marlow also gave a great talk about about the
concurrency mechanisms in Haskell. He commented that MVars
are great for building other concurrency constructs, but
not very useful for application programming, as it's
far too low-level. The Haskell version of chameneos_redux
relies critically on MVars, and all the top entries use
various forms of spin locks.

* http://www.cse.unsw.edu.au/~pls/damp09/programme.html

There are many things about chameneous_redux that cause
problems for the Erlang VM, and it's used as one benchmark
in the work to optimize it. Still, the expressed goal for
the optimization work is to give speedup to typical Erlang
programs without forcing programmers to rewrite their
code for multicore.

At the other end of the spectrum, I recently observed an
erlang-based system under extreme load reach 350% CPU
on a quad-core (i.e. max is 400%, and given that the cores
must share memory and peripherals, I doubt that you can
get much higher utilization than that), still maintaining
good througput while handling the incoming burst
gracefully. That's pretty amazing.

> A school of thought seems to exist that because Erlang
 > fares poorly on these sorts of problems that you
 > shouldn't even try to use Erlang to address them,
 > and that's not a school of thought I particularly like.

One particular trait about Erlang is that it ranks
pretty high on conceptual integrity (IMHO) - a bit like
SmallTalk and Haskell, it has a clear idea on how you
should write programs. I won't claim that this concept
absolutely precludes efficient solutions to problems
like chameneos_redux, but at least I think that the
maintainers of the Erlang VM have their priorities
straight.  ;-)

BR,
Ulf W

-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com



More information about the erlang-questions mailing list