[erlang-questions] VM & BEAM Specs : idea for improving thelists support

Sean Hinde sean.hinde@REDACTED
Mon Aug 6 20:24:03 CEST 2007


It has been interesting, and I also wondered about some of the same  
things in my early days of using Erlang.

Since then, over the last 8 years or so (lost track..) of using  
Erlang I've never had any reason to be concerned about the amount of  
memory that strings as lists wastes. If you want to process a very  
large text file then do it in chunks (and 4 times less memory usage  
will not save you from a text file that is 1000 times larger than  
"expected").

If you want to store a lot of text in mnesia then either convert it  
to a binary first, or rely on the ets optimisation that automatically  
flattens short "string lists" into byte arrays for storage.  
Inevitably such things will eventually end up being shipped down a  
socket or into a file. Both operations can take deep lists of  
binaries and other Byte sized pieces so the processing overhead is  
small.

In short, it has been a total non-issue in the problem domains I've  
tackled (quite varied)

Sean

On 6 Aug 2007, at 18:57, David Mercer wrote:

> This has been an interesting thread.  Thanks!  Question below...
>
> On Monday, August 06, 2007 01:41 ok wrote:
>>> The benefit is again in both performance and memory consumption.
>>> Imagine that a program has consumes a large text document with
>>> English,
>>> Arabic and Russian characters. The current implementation will
>>> consume 4
>>> times more memory than an automatically-typed vector-based  
>>> version. In
>>> case the document contains only ASCII characters, the memory
>>> consumption
>>> will drop 8 times.
>>
>> Only if someone is daft enough to store the whole thing as a  
>> simple list
>> of characters.  There are much better ways, in the language and using
>> the
>> implementation that we now have.
>
> For newbies among us, are you referring to storing it as a binary, or
> something else?
>
> Thanks.
>
> Cheers,
>
> David
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list