[erlang-questions] list vs binary performarnce, destructuring and consing
Tue Oct 23 17:56:31 CEST 2012
I tried the tests with native compilation (erlc +native json.erl) and found
about a 40-50% speedup for binary, and 10-20% for lists (median-mean). Just
10 samples each for this back of the envelope test. So lists went from
being over twice as fast to about 1 1/2 times as fast.
On Tue, Oct 23, 2012 at 2:00 AM, Loïc Hoguin <> wrote:
> On 10/23/2012 10:50 AM, Motiejus Jakštys wrote:
>> On Tue, Oct 23, 2012 at 9:07 AM, Martynas Pumputis <>
>>> Could you show the exact steps of your simulation? Binary version should
>>> faster, because some extra memory allocation is avoided per each
>>> and large binaries aren't being copied.
>>> Take a look at:
>> I tried that last night and was surprised, so will share.
>> Benchmark script:
>> https://gist.github.com/**3937666 <https://gist.github.com/3937666>
>> 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.
> Please try with the module t compiled with the native option.
> Also the answer to "why binary" is generally either "because unicode" or
> "because memory", not "lol speed". But it would be good if "lol speed"
> could be improved eventually.
> Loïc Hoguin
> Erlang Cowboy
> Nine Nines
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions