4 ms·
> The big issue I have with pattern matching / binaries (aka, strings) in elixir / erlang is that doing it efficiently is, at best, a dark art and, at worst, im
by kamikaz1k 6y ago
> The big issue I have with pattern matching / binaries (aka, strings) in elixir / erlang is that doing it efficiently is, at best, a dark art and, at worst, impossible.
Sorry, can you elaborate what you mean by impossible? Or maybe what you mean by efficient.
Thanks!
- latch 6y agoI just spent some time looking at some old code, and it does seem like OTP 22 solved any of the issues that I had run into at the time. My mistake, sorry about that. (Though I maintain that it's still opaque)
- ergl 6y agoThere's a section about pattern matching and binaries at https://erlang.org/doc/efficiency_guide/binaryhandling.html https://erlang.org/doc/efficiency_guide/binaryhandling.html Compiling with the bin_opt_info flag (erlc +bin_opt_info Mod.erl) will list the points in your code where binaries are created during pattern match, or any other points where binaries could be shared, but are not.