[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: One trivial querstion about datatype
From: |
Dmitry Morozhnikov |
Subject: |
Re: One trivial querstion about datatype |
Date: |
Sun, 23 Dec 2001 18:05:16 +0800 (IRKT) |
On 21 Dec 2001, Alex Shinn wrote:
AS> This is probably the closest thing to a "sequence," in that it
AS> will give almost vector speed access and will perform well if you
AS> build the sequence in order.
Yes, thanks for detailed explanation! I adopt this (just make
allocation chunk of elements instread of one) and see this have
acceptable speed on adding elements.
But why guile can`t have vector-set-length! as in SCM? It is easy
in implementation and usefull.
AS> If access speed is the most important thing, and you're
AS> building up arbitrary elements of a potentially large sequence,
AS> you might consider a hash.
I think it`s overkill. :-)
AS> If you want something more like the list/array data types in
AS> scripting languages such as Python/Perl, where you want to
AS> quickly push elements onto either end of the data structure (
AS> treating them both as vectors and lists) then you might try a
AS> list of vectors rather than the single vector above. Appending (
AS> pushing, etc.) applies the above approach to the last element of
AS> the list, and cons (unshift in Perl speak) then means cons'ing a
AS> new single element vector onto the front of the list (probably
AS> with consolidation routines).
It`s intresting.. Go look how it implemented in perl.. How
determine time when list of many vectors must be rebuilded in one
vector for fast referencing?
--
DM, Dmitry Morozhnikov, PGPKEY 0xB6C14D95