[erlang-questions] clueless performance question

Bjorn Gustavsson <>
Wed Jun 11 11:49:51 CEST 2008

Zvi <> writes:

> from my PI serial benchmarks, floating point performance is weak point of
> Erlang, since float values always allocated on the Heap.

Actually, the Beam compiler does some limited optimization of floating point
expressions to avoid storing temporary floating point values on the heap.
The catch is that the compiler can only do the optimization if it can figure
out that a variable is guaranteed to be a float at run-time. Currently,
the compiler is not very smart about figuring out types by itself, so you'll
need to use is_float/1 guards. Here is an example from Wings:


Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list