Erlang: atoms or integers

I want to convey the message as such

{up, Distance}
{down, Distance}

I could also do it as such

{1, Distance}
{-1, Distance}

The key difference is that one is an atom and the other is an integer. Read the pages here:

http://www.erlang.org/doc/efficiency_guide/advanced.html

both an integer and an atom occupy 1 word in memory. However, they mention the atom table and must refer to it.

My question is, does the atom table reference every time an atom is used? Which of my examples is most effective?

+5
source share
1 answer

. . ( , ).

.

+12

All Articles