Erlang does have problems

Bob Ippolito <>
Wed Aug 30 22:29:12 CEST 2006


The overhead of lists-as-strings on 64-bit platforms is 8x for latin-1
text for just the 8-bit vs 64-bit data types, which completely ignores
the overhead of the list itself and whatever overhead there is to
tracking integers (if that's what Erlang does). At some point, all of
that storage bloat has to end up being a loss due to all of the memory
bandwidth being used up.

Inserting and deleting pieces could be fast operations if
iodata-of-just-binaries were allowed instead of requiring binaries.
All of the slicing and dicing should be memory-friendly since the
majority of the time it will be a view on some larger binary in
memory... so really it should be faster and more memory efficient in
many cases because splitting a binary in half doesn't require copying
of the first N/2 elements of the list.

-bob

On 8/30/06, Robert Virding <> wrote:
> No, while binaries, or a string data type equivalent, are definitely
> much more space efficient (a factor 2-8 depending on encoding) they are
> probably much slower for processing strings. Especially for pulling them
> apart and rebuilding them, and inserting or deleting bits which would
> entail much copying. Of course you could make a more complex datatype
> which keeps the characters in a linked sequence ... :-)
>
> Strings as lists also has the benefit that you can more easily work on
> 16 or 32 bit unicode characters directly without worrying about
> encoding. Then encode them when done. I would keep the statis strings as
> binaries and dynamic ones as lists.
>
> Robert
>
> Joel Reymont wrote:
> >
> > On Aug 30, 2006, at 4:25 PM, Bob Ippolito wrote:
> >
> >> How is it less of a problem with lists? There still isn't any support
> >> for text encodings in what ships with Erlang (that I've been able to
> >> find, anyway).
> >
> >
> > I (naively?) assumed that it's easier to process text encodings using
> > lists than binaries. It should be the same, now that I think about  it,
> > just using much less space with binaries and maybe even faster.
> >
> > --
> > http://wagerlabs.com/
>
>



More information about the erlang-questions mailing list