>List!s are actually stored differently from blocks, paths and hashes,
>so any operation on them requires special code that has not been
>implemented for all action types.
>  - jim

It makes sense, of course.
If you need random access by position number then don't use a list.
That is almost by definition. Use a regular block instead.

Lists are I am guessing very efficient for certain algorithms requiring
rapid insertion/deleetion and sequential access only.
Since blocks are pretty fast, you would only need lists for
getting the extra performance boost in some critical code with certain
algorithms.
Maybe the list also uses slightly less storage overhead per element?

I doubt that the "special code" he refers to would be hard to write,
it's just that it would be slow as hell, you would for instance get
the 352nd element by starting at the head of the list and skipping
down 352 times.  Real Fast, eh?  That's why you don't even
want to do that.

But think about implementing a fast stack, where you insert or push an
object at the head of the list and pull or pop it also from the head.
This is one job that a list can do really efficiently.  I am sure
others can think of more.  I don't know if we have fast access
to the tail of the list also.  Normally one would assume that
reaching the tail would be slow unless a pointer is kept to it
specially.

Basically, if you can't imagine why you would need a list,
you probably don't need one.



Reply via email to