Ulf Wiger ulf@REDACTED
Tue Sep 13 21:17:14 CEST 2005

Den 2005-09-13 16:31:29 skrev Ulf Wiger (AL/EAB) <ulf.wiger@REDACTED>:

> Sven-Olof Nyström wrote:
>> Ulf Wiger (AL/EAB) writes:
>>  > The first example doesn't really introduce
>>  > anything new, as it scans the whole tree
>>  > (most likely less efficient than iterator())
>> or to_list().
> Yes, well, I've grown a bit allergic to functions
> that return the whole contents of a data structure
> designed to be scalable. Given how the garbage
> collector works, you should only use them if you
> are sure that the number of objects is relatively
> small;

Of course, to be fair, there's a big difference in
this regard between ets and e.g. gb_trees: since
all objects in gb_trees already reside on the heap,
to_list() only builds a bunch of cons cells
pointing to already existing objects, whereas ets
actually copies the objects onto the heap, causing
potentially massive memory allocation.

Ulf Wiger

More information about the erlang-questions mailing list