[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why vectors?



[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
per@xxxxxxxxxxx   http://per.bothner.com/