[erlang-questions] strings vs binaries

Rick Pettit rpettit@REDACTED
Tue Aug 18 22:29:42 CEST 2015


Had not seen that before Felix—thanks for the link.

-Rick

> On Aug 18, 2015, at 3:27 PM, Felix Gallo <felixgallo@REDACTED> wrote:
> 
> The redoubtable @jlouis666 has an excellent blog post about strings that may be of interest: https://medium.com/@jlouis666/erlang-string-handling-7588daad8f05 <https://medium.com/@jlouis666/erlang-string-handling-7588daad8f05>
> 
> F.
> 
> On Tue, Aug 18, 2015 at 1:23 PM, Rick Pettit <rpettit@REDACTED <mailto: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 <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 <mailto: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 <mailto:erlang-questions@REDACTED>
>> http://erlang.org/mailman/listinfo/erlang-questions <http://erlang.org/mailman/listinfo/erlang-questions>
> 
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
> http://erlang.org/mailman/listinfo/erlang-questions <http://erlang.org/mailman/listinfo/erlang-questions>
> 
> 

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


More information about the erlang-questions mailing list