<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">On Mon, Nov 12, 2018 at 12:35 PM Roger Lipscombe <<a href="mailto:roger@differentpla.net">roger@differentpla.net</a>> wrote:</span><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I was kinda hoping to avoid that -- I've got a vague feeling that we<br>
did this for performance reasons. Of course, those assumptions are<br>
probably no longer valid and need re-checking.<br>
<br></blockquote><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">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.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I'd measure this carefully.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><br></div></div></div>