Erlang Efficiency quesitons

Francesco Cesarini <>
Wed Mar 14 17:44:01 CET 2001


I was wondering if there is any documentation on how to write efficient
Erlang programs based on the virtual machine delivered in with OTP R7?
Many odds and ends have been discussed on this list, but I have been
unable to find something comprehensive.

Here are some examples from one of Bogumil's early beam implementations
used in 1995 - 96. Are they still valid today after Björn's rewrite?

At the time it was better to group clauses according to the matching
which had to be done. For example

case X of
  {a,b,c} -> ..
  {b,c,A} -> ..
  {A,B,C} -> ...
  {a,b}   -> ...
  {A,b}   -> ..
  true    -> ..
end

was more efficient than :

case X of
  {a,b,c} -> ..
  true    ->  
  {a,b}   -> ...
  {A,b}   -> ..
  {b,c,A} -> ..
  true    -> ..
  {A,B,C} -> ...
end

(The above apparently also applied to ifs, receives and function
clauses).

Another example had to do with avoiding the dynamic creation of atoms as
there was no GC for them. Is that still the case?

I could go on and on with more examples, but i'll leave it to that. Any
feedback on where I can find more comprehensive info is welcome.

Regards,
Francesco

-- 
Francesco Cesarini

Erlang/OTP consultant
Cellular: INT+44-7776 250381 
ECN: 832-707192
http://welcome.to/cesarini.consulting



More information about the erlang-questions mailing list