vector - to use or not to use....

Bjorn Gustavsson <>
Wed Feb 12 08:33:58 CET 2003


The problem with vectors is that they effectively turn off the
generational garbage collector, so that all live data will be copied
on every garbage collection.

That problem makes vectors unsuitable for general use. For some uses,
vectors are clearly faster than alternative heap-based data structures.

There is an implementation of heap sort in the vector.erl module itself.

I did some measurements, comparing that implementation to a similar using
tuples. The vector version is faster. But lists:sort/1 is even faster.

/Bjorn

david wallin <> writes:

> Hi,
> 
> I've been working on a small and very secret project I like to call 
> 'heapsort' (name not taken randomly).
> Currently, it uses the vector module. But as this seems to be an 
> undocumented module, should I take it that it is an internal module 
> that shouldn't be used ?
> 
> cheers,
> 
> --david.
> 

-- 
Björn Gustavsson            Ericsson Utvecklings AB
      ÄT2/UAB/F/P
			    BOX 1505
+46 8 727 56 87 	    125 25 Älvsjö



More information about the erlang-questions mailing list