message copying overhead atoms vs binaries

Paolo Negri <>
Mon Jan 10 11:56:27 CET 2011


Dear list,

I'm trying to understand what approach of building values contained in
messages to pass across processes would be more efficient (in terms of
memory and cpu) and if the difference is significant.
I could build my message values in two ways

a) [{color, red}, {shape, circle}]

b) [{color, <<"red">>}, {shape, <<"circle">>}]

The set of values is strictly limited (in the order of hundreds and
not over 1000) and these values are constantly used by the system so
the fact that atoms would be permanently allocated is not a problem in
this case.

The actual lists are longer and can vary in length between 5 to 10 elements.
The processes will exchange thousands of these messages each second
and this is the reason why I'm asking this question.

I'd like to know which form is cheaper in term of copy operation in
both cases internally on a single node or across nodes hosted on
different physical machines.

Thanks for your help,

Paolo

-- 
Engineering
http://www.wooga.com | phone +49-30-8962 5058  | fax +49-30-8964 9064

wooga GmbH | Saarbruecker Str. 38 | 10405 Berlin | Germany
Sitz der Gesellschaft: Berlin; HRB 117846 B
Registergericht Berlin-Charlottenburg
Geschaeftsfuehrung: Jens Begemann, Philipp Moeser


More information about the erlang-questions mailing list