[erlang-questions] Small performance hint: avoid abusing module_info(attributes)

Сергей Прохоров <>
Thu Sep 28 11:19:29 CEST 2017

It looks like attribute list is stored in `term_to_binary` format inside of
a .beam file.

So, each time you call `M:module_info(attributes)`, it decodes whole
attribute list using `binary_to_term`:


That may be ok for small list, but you, probably, have a lot of them (how

Another question is how did you lookup this attribute list? lists:keyfind?
This one, obviously, may be slow on a large lists.

But, at least, it doesn't look like `module_info(attributes)` uses any
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170928/03ba0fa9/attachment.html>

More information about the erlang-questions mailing list