Re: Why vectors? Per Bothner 11 Aug 2008 09:04 UTC

[Off-topic, but a pet peeve of mine.]

Elf wrote:
> As records are essentially vectors (constant sized, fixed order, etc) with
> procedures mapping to indices, using lists would be a significant
> performance
> cost for no benefit: one generally doesn't iterate over the elements of a
> record.

Regardless, it is much faster on modern processors to iterate over the
elements of a vector than the elements of list.  Never (well,
almost never) use linked lists if you care about performance.  Even
if you need to build a sequence incrementally it's usually faster to
use a vector and double its size when needed.

Remember that on a modern desktop-or-above processor computation is
free to a first approximation - what is expensive are cache misses!

That is why 40-year-old APL (with its potential for parallelism) is the
language of the future ...
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/