[erlang-questions] Temporarily violating record type constraints annoys dialyzer

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Tue Nov 13 15:49:06 CET 2018


On Mon, Nov 12, 2018 at 12:35 PM Roger Lipscombe <roger@REDACTED>
wrote:

> I was kinda hoping to avoid that -- I've got a vague feeling that we
> did this for performance reasons. Of course, those assumptions are
> probably no longer valid and need re-checking.
>
>
A lists:keyfind on a small list is going to be fast, especially because you
are only reading and thus not putting any GC pressure in there. Your
parsing variant constructs a number of intermediate tuples and I don't
think the Erlang compiler currently detects it can unroll that loop, and
strength reduce the tuple creation so it has higher GC pressure.
Alternatively, put it into a map and then transform the map. It is at most
one write more.

I'd measure this carefully.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181113/2254c74d/attachment.htm>


More information about the erlang-questions mailing list