[erlang-questions] Question about implementation

Loïc Hoguin essen@REDACTED
Sat Sep 15 01:45:58 CEST 2012


On 09/10/2012 07:35 PM, Daniel Dormont wrote:
> On Mon, Sep 10, 2012 at 12:08 PM, Lukas Larsson
> <lukas@REDACTED <mailto:lukas@REDACTED>> wrote:
>     Hello,
>     Only the tuple which is the record and the immidiates (i.e. small int,
>     atom, pid, ref etc) will be copied. All other parts use pointers
>     internally and the same pointers will be copied into the correct
>     places within the tuple. So in this case a new 6 word memory block
>     will be created and filled with the atom undefined and finally the new
>     counter.
>     I think that the compiler does some optimization based on updating
>     tuples within the same function body, though I've forgotten what it is
>     it does.
> This bit?
> http://www.erlang.org/doc/efficiency_guide/commoncaveats.html#id61731

Is the optimization applied automatically to records?

Loïc Hoguin
Erlang Cowboy
Nine Nines

More information about the erlang-questions mailing list