<div style="white-space:pre-wrap">in somewhat related i studied recently the impact of each for a simple lookup in erlang-idna. The main goal was to find the best write-once read-only K/V data structure  to embed in a beam without the cost of ets or a gen_server:<br><br><a href="https://github.com/benoitc/erlang-idna/issues/12">https://github.com/benoitc/erlang-idna/issues/12</a><br><br>between pattern matching and maps on a string with 29915 entries maps were faster and -  not sure why - it creates a smaller beam. Maps are also faster to compile and use less memory in the process. <br><br>anyway you should probably test the right one for your case.<br><br>- benoît</div><br><div class="gmail_quote"><div dir="ltr">On Wed, 16 Mar 2016 at 09:05, 饕餮 <<a href="mailto:249505968@qq.com">249505968@qq.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>erlang pattern match file could be written like :</div><div><br></div><div>-module(config).</div><div>get(1) -> 11,</div><div>get(2) -> 22,</div><div>.....</div><div>get(1000001) -> 12312,</div><div>get(_) -> none.</div><div><br></div><div>When I need get some data,</div><div><span style="line-height:1.5">ets:lookup(some_table, some_value)</span></div><div>&</div><div>config:get(some_value)</div><div><br></div><div>Which one is more efficiency?</div><div>How much different between them?</div><div><br></div><div><br></div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>