[dundee] old posts on Erlang vs Stackless python

Rick Moynihan rick.moynihan at gmail.com
Wed Apr 23 11:07:58 BST 2008


Hey Kris,

Sorry for the delayed reply; just back from my holiday and catching up
on emails.

2008/4/11 azmodie <azmodie at gmail.com>:
> just surfing about came across some intresting links.
> these links are inspired by an exercise set after chapter 8 of Joe
> Armstrong's Erlang book
>
> comparison with stackless python
> http://muharem.wordpress.com/2007/07/31/erlang-vs-stackless-python-a-first-benchmark/
>  (NOTE: after reading comments, this is not a brilliant comparison. but
> raises some good points)

Yes, I saw this benchmark sometime ago; but it doesn't really say
anything meaningfull.  Indeed the circular message passing benchmark
suggested by Joe is a poor benchmarking choice as the algorithm is
inherently serial.  i.e. there is no scope for parallelism across
cores or machines because a process can only "pass the parcel" when it
has it.

A far better benchmark (IMHO) for measuring concurrent performance is
this one.  Here when you double the number of cores/cpu's you
effectively halve the benchmark time(!!) on Erlang:

http://www.franklinmint.fm/blog/archives/000792.html

The algorithm here is to have every process message every other
process.  Which is far more ammenable to parallelisation than a
message-ring.  Erlang will completely trounce stackless in this
benchmark, because neither python or stackless cannot take advantage
of multiple OS threads because of the GIL (Global Interpreter Lock).
That's not to say that I don't think stackless is good; just that it
can't take advantage of multi-core!

> comparison with termite
> http://jaortega.wordpress.com/2007/05/14/erlang-termite-and-a-blog/

Yes Termite and Gambit Scheme look pretty cool.  The big benefit of
Termite is that you get macros, which are an awesome feature of the
Lisp dialects which allow you to effectively extend the compiler
within the context of your program, with the language you're coding
in!

When I last checked though, Termite was pretty much an academic
project.  Erlang has 20 years of industrial and commercial use behind
it, in an unforgiving domain.  So whilst Termite is undoubtedly great
fun, Erlang is probably the sensible choice for real applications.

> i'm sure there are many more out there.

Yes, many languages are trying to adopt "Erlang-like concurrency
models".  The problem is retrofitting these features onto other
languages often only leads to small improvements, because the majority
of the language and libraries are written without using the correct
idioms.

> so Rick as your are playing with erling what is your take on these ?
> have you tried this exercise yourself ?.

No.  The only real benchmark I've done is testing the speed of process
spawning under Erlang, which is lightning fast; something like 100,000
processes in under 2.5 seconds on a modest Athlon 64 3000.

I generally don't tend to read too much into micro-benchmarks, as you
often end up comparing apples and oranges.  Though often the
discussion surrounding them is good, and is a good way to learn about
the lower details of the languages and their semantics.

--
Rick Moynihan
rick.moynihan at gmail.com
http://sourcesmouth.co.uk/blog/



More information about the dundee mailing list