[erlang-questions] when is data copied?

Dmytro Lytovchenko dmytro.lytovchenko@REDACTED
Fri Mar 17 11:55:14 CET 2017


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.
There's nothing you can optimize in regards to the data copying.

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). )

2017-03-17 11:45 GMT+01:00 Xavier Noria <fxn@REDACTED>:

> Awesome, thanks!
>
> What about pattern matching?
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170317/2b6616b1/attachment.htm>


More information about the erlang-questions mailing list