In relation to a post on the Erlang mailing
list here is a pretty interesting post over at Tenerife Skunkworks
about the speed of setting and getting variables (specifically arrays, tuples etc) in Erlang. Interestingly tuples are much faster at 'get' than arrays and arrays are much faster at 'set'. To that end getting a tuple is multiple orders of magnitudes faster than setting it.
The tuple test pre-allocates a tuple of 10k or 100k elements. There's no destructive assignment in Erlang and so the same large tuple needs to be allocated and discarded on every set operation. It's very inefficient to allocate and discard a large tuple on every set operation, thus naive tuple set is very slow.
The array module uses an efficient tree-like internal representation...