[erlang-questions] strings vs binaries

Rick Pettit rpettit@REDACTED
Tue Aug 18 22:23:32 CEST 2015


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150818/b714efd7/attachment.htm>


More information about the erlang-questions mailing list