binaries vs lists

Serge Aleynikov serge@REDACTED
Tue Nov 11 15:58:18 CET 2003

Bengt Kleberg wrote:
> Serge Aleynikov wrote:
>> Hi!
>> I was wonderting if someone could contribute a thought to the 
>> following question regarding efficiency.
> does it have to be efficient? have you found this to be a bottle neck?

The expected flow is over 1000 binary messages / second.  I haven't yet 
found this to be a bottleneck, but I'd prefer to have the extra CPU time 
available for other Erlang tasks.

>> I have an Erlang TCP client that processes a binary stream which needs 
>> to be post-processed by removing escaped bytes.  Let's say, that byte 
>> 16$FF is escaped as <<16#FE, 16$01>>, and the 16#FF value is used as a 
>> message separator.  The variable hex messages are within 512 bytes each.
> if i understood the 512 bytes statement correctly, it is ok to build the 
> list on the stack, thus avoiding lists:reverse/1 in solution 1.

Do I have a control over where the list is being built (heap/stack)?  Or 
this is purely dependent on the list size?  If so, are you implying that 
I should append items at the end instead of doing it in front, and using 
lists:reverse/1 ?


More information about the erlang-questions mailing list