[erlang-questions] list vs binary performarnce, destructuring and consing

Motiejus Jakštys desired.mta@REDACTED
Tue Oct 23 10:50:25 CEST 2012


On Tue, Oct 23, 2012 at 9:07 AM, Martynas Pumputis <martynasp@REDACTED> wrote:
> Hi,
>
> Could you show the exact steps of your simulation? Binary version should be
> faster, because some extra memory allocation is avoided per each iteration
> and large binaries aren't being copied.
>
> Take a look at:
> http://www.erlang.org/doc/efficiency_guide/binaryhandling.html
>

I tried that last night and was surprised, so will share.

Benchmark script:
https://gist.github.com/3937666

Session:
1> t:bench().
Creating str of size 1048576.. done.
Converting to binary.. done.
Executing STR copy 30 times... done.
Executing BIN copy 30 times... done.
BIN: Mean:   139461.1, stdev:   7829.9
STR: Mean:    79089.4, stdev:  53349.0

No matter how hard I try, I cannot outperform lists.

R15B02, 32-bit Linux.

-- 
Motiejus Jakštys



More information about the erlang-questions mailing list