Record efficiency

Erik Rigtorp <>
Wed Jul 29 17:22:02 CEST 2009


Hi!

I'm trying to figure out the performance characteristics of records.
I've been looking at the code at it seems like named attribute access
on records gets turned into some function evaluation by the
preprocessor. I'm trying to read a bunch of attributes of a record and
there are two ways to do this.

Either:
Rec#rec{attr1 = Attr1, attr2 = Attr2}
Or:
Attr1 = Rec#rec.attr1
Attr1 = Rec#rec.attr2

Will these two have the same performance or will the first one just be
a match and the second one result in two function calls?

Erik


More information about the erlang-questions mailing list