[erlang-questions] strings vs binaries

Felix Gallo felixgallo@REDACTED
Tue Aug 18 22:27:21 CEST 2015


The redoubtable @jlouis666 has an excellent blog post about strings that
may be of interest:
https://medium.com/@jlouis666/erlang-string-handling-7588daad8f05

F.

On Tue, Aug 18, 2015 at 1:23 PM, Rick Pettit <rpettit@REDACTED> wrote:

> Generally speaking, you probably want to use binaries these days as they
> consume far less memory (at least for “large” strings):
>
>   http://www.erlang.org/doc/efficiency_guide/advanced.html
>
> That goes for both sending over the wire as well as internally.
>
> -Rick
>
> On Aug 18, 2015, at 3:16 PM, Ben Hsu <benhsu@REDACTED> wrote:
>
> Hello
>
> I have a simple question, I know Erlang has strings and binary strings as
> separate data types, and they're different even if they "look the same" in
> the console
>
>
> 1> io:format(<<"fnord">>).
> fnord
> 2> io:format("fnord").
> fnord
>
> 3> "fnord"==<<"fnord">>
> 3> .
> false
>
> My question is when you will use each one. Are binary strings used for
> sending data over the wire, and normal strings used internally? what are
> the tradeoffs?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
> _______________________________________________
> 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/20150818/0043d611/attachment.htm>


More information about the erlang-questions mailing list