<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Generally speaking, you probably want to use binaries these days as they consume far less memory (at least for “large” strings):<div class=""><br class=""></div><div class="">  <a href="http://www.erlang.org/doc/efficiency_guide/advanced.html" class="">http://www.erlang.org/doc/efficiency_guide/advanced.html</a></div><div class=""><br class=""></div><div class="">That goes for both sending over the wire as well as internally.</div><div class=""><br class=""></div><div class="">-Rick</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 18, 2015, at 3:16 PM, Ben Hsu <<a href="mailto:benhsu@gmail.com" class="">benhsu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hello<div class=""><br class=""></div><div class="">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</div><div class=""><br class=""></div><div class=""><div class=""><br class="Apple-interchange-newline">1> io:format(<<"fnord">>).</div><div class="">fnord</div><div class="">2> io:format("fnord").</div><div class="">fnord</div></div><div class=""><br class=""></div><div class=""><div class="">3> "fnord"==<<"fnord">></div><div class="">3> .</div><div class="">false</div></div><div class=""><br class=""></div><div class="">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?</div></div>
_______________________________________________<br class="">erlang-questions mailing list<br class=""><a href="mailto:erlang-questions@erlang.org" class="">erlang-questions@erlang.org</a><br class="">http://erlang.org/mailman/listinfo/erlang-questions<br class=""></div></blockquote></div><br class=""></div></body></html>