The Erlang virtual machine is constantly being optimized and improved. What might have been inefficient constructs or necessary workarounds in earlier releases are not necessarily a problem in the current version. So, beware when reading about efficiency, workarounds, and optimizations in old performance guides, blog entries, and especially old posts in newsgroups and mailing list archives. If in doubt, always refer to the release notes and documentation of the runtime system you are using. And most importantly, benchmark, stress test, and profile your systems accordingly.
The most common misconceptions regarding efficiency concern
funs and list comprehensions. List
comprehensions allow you to generate lists and filter elements, and
funs allow you to bind a functional
argument to a variable. Today, the compiler translates list
comprehensions to ordinary recursive functions, and
funs were optimized a long time ago and have
gone from being highly inefficient black magic to having performance
between that of a regular function call and using an
Strings are not implemented efficiently in Erlang. In the 32-bit representation, every character consists of four bytes, with an additional four bytes pointing to the next character. In the 64-bit representation, this doubles to eight bytes. On the positive side, Unicode is not an issue. On the negative side, if you are dealing with large data sets and memory does become an issue, you will need to convert ...