Erlang futures

James Hague jamesh@REDACTED
Tue Apr 17 15:59:48 CEST 2001


> I was under the (perhaps incorrect) impression that the 
> overhead of those
> "last few bytes of memory" was something like 7 bytes per 
> character in the string.
> 
> It's the old "Bloatware == ease of use" trade-off that 
> produces animated talking
> paperclips.

Look at it this way:  If you have 256K of active strings in an
application--and that's a huge amount--then you are only wasting 1.75
megabytes of data by storing them as strings. At one time that would have
sounded horrendous, but it is does not sound so bad now, not when there are
libraries that commonly need 8M for undefined internal use :)

There are two things that help tremendously with strings:

1. If you are doing things like fetching and parsing web pages, just handle
the pages as binaries. It is just as easy to parse a binary as a string, and
there is no wasted space.

2. Very rarely do you need to have tons of strings just sitting around,
stored as strings. When you file away a string for the moment and don't
expect to look at it for a while, call list_to_binary on it first.

James



More information about the erlang-questions mailing list