[erlang-questions] map over bitstring

Morten Krogh mk@REDACTED
Mon Oct 25 12:23:25 CEST 2010


Kostis,

I followed your suggestion and compiled it to native code with erlc 
+native zip2.erl, which improves the runtime for
both methods.

The run times are, for a 100 MB binary, and the map function X -> X + 1 
hard coded into the module and into the map method itself (which is not 
quite realistic):

Not native:

comprehension :     10 s
my own bit syntax function : 14s

native:

comprehension: 3.7 s
my own bit syntax function: 6 s

So, yes native is an improvement!

Morten.



On 10/25/10 11:30 AM, Kostis Sagonas wrote:
> Morten Krogh wrote:
>> Sorry, in my recent reply to Tony I tested the comprehension on the 
>> constant ><<"B"">>.
>>
>> Putting everything in the module and comparing the same mapped 
>> function ,f , the result is that the comprehension is 30% faster than 
>> my matching based map function.
>
> Morten,
>
> You may also want to try compiling the file to native code and report 
> whether or how this improves/changes the results.
>
> Cheers,
> Kostis



More information about the erlang-questions mailing list