Thu Oct 25 10:39:10 CEST 2001
On Thu, 25 Oct 2001, Bengt Kleberg wrote:
Bengt> > Date: Wed, 24 Oct 2001 16:35:14 -0700
Bengt> > From: Erik Pearson <erik@REDACTED>
Bengt> > However, this seems at first blush inefficient and cumbersome. Is this
Bengt> > true? Perhaps atoms are stored very efficiently? (Of course, the tag
Bengt> > atoms could be made shorter as well)
Bengt> Atoms are stored efficiently.
Bengt> Atoms use the same space independent upon their length.
This holds within an Erlang node and to some extent when atoms are
sent between nodes, due to the built-in atom cache used for
In the external format for atoms, the entire "name" of the atom needs
to be stored as it does not suffice to store only the atom number.
The internal atom numbers are only valid within one Erlang node and
they may be re-calculated after node restart.
The external format is used by Erlang/OTP for file storage (dets,
disk_log, disk resident Mnesia tables etc.) but is also convenient for
other purposes when an arbitrary Erlang term needs to be externalized.
Here you can see the external size of 'undefined' vs. 'u':
Erlang (BEAM) emulator version 5.1 [threads:0]
Eshell V5.1 (abort with ^G)
If you get performance problems, there are most likely other things in
your program that causes the trouble and not the length of atom names.
The handling of atoms in Erlang is very efficient and you should stick
with mnemonic atom names.
Computer Science Laboratory
More information about the erlang-questions