[erlang-questions] string concatenation efficiency

Sergej Jurečko sergej.jurecko@REDACTED
Thu Jan 28 08:25:29 CET 2016


If your string is going to be sent over a socket or written to a file, an
iolist is always the most efficient: ["Item:{", ItemID, "}"]
If you must have flat strings, just use ++

Sergej

On Thu, Jan 28, 2016 at 8:22 AM, Khitai Pang <khitai.pang@REDACTED>
wrote:

> Hi,
>
> For string concatenation, which one of the following is the most efficient?
>
> 1)
> strings:join(["Item:{", ItemID, "}")], ""]
>
> 2)
> lists:append(["Item:{", ItemID, "}")])
>
> 3)
> "Item:{" ++ ItemID ++ "}"
>
> Here ItemID is a UUID.
>
>
> Thanks
> Khitai
> _______________________________________________
> 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/20160128/dc5c5df6/attachment.htm>


More information about the erlang-questions mailing list