<div dir="ltr">Pattern matching is broken into a decision tree during compile time, and this tree is evaluated while doing jumps to corresponding clauses. It is normal Erlang code under the hood, which manipulates Erlang values normally withing current process, so they are handled efficiently.<div><div>There's nothing you can optimize in regards to the data copying.</div><div><br></div><div>To see how bad is the code you can do benchmarks yourself using timer:tc, thats the simplest. You can compile to intermediate code such as Kernel erlang (shell command c(mymodule, [to_kernel]). ) and read the produced code, or disassemble the module (shell command erts_debug:df(module). )</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-03-17 11:45 GMT+01:00 Xavier Noria <span dir="ltr"><<a href="mailto:fxn@hashref.com" target="_blank">fxn@hashref.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Awesome, thanks!</div><div class="gmail_extra"><br></div><div class="gmail_extra">What about pattern matching?</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div>
<br>______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>