Subject: Re: Cookbook question: How to change a list to a vector?
From: Erik Naggum <erik@naggum.net>
Date: Sat, 16 Feb 2002 08:05:10 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3222835513335580@naggum.net>

* Thaddeus L Olczyk
| Given a system that is running slower than you would like.  One thing
| that you wish to do is replace a list with a vector since you can see
| many inefficient operations on the list.  How would one proceed?

  For what it is worth, I thought your question was quite clear, but the
  answer is also quite obvious: you hunt down all the references to the
  list and chnage the design to use a vector, instead, but this you knew.
  This is quite trivial, however, since the list is more than a "class": a
  data structure with methods, it embodies a particular design.  In effect,
  your question translates to "how much of the design depends on the choice
  of the list data structure?"  Individual programs differ greatly in this
  regard, but the more you have optimized your code for lists, the more
  work it will take to change to vectors.  However, it is not very common
  to use nth to access list elements, and people tend to pass around other
  cons cells than the first in the list.  This is especially true for those
  who suffer from Scheme exposure, who mistakenly believe that recursion on
  lists is a good thing.  They have to redesign the whole solution to use
  another algorithm they are inexperienced with to get better performance.

///
-- 
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.