[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: |
Tue, 25 Dec 2001 01:34:34 +0800 (IRKT) |
On Sun, 23 Dec 2001, Keith Wright wrote:
??>> From: Dmitry Morozhnikov <address@hidden>
??>> But why guile can`t have vector-set-length! as in
??>> SCM? It is easy in implementation and usefull.
KW> It's just as easy to implement in Scheme as in C.
KW> Unless I am missing something, the implementation would
KW> be about the same in either case. The C standard
KW> library has a procedure 'realloc' which also does the
KW> same thing---if the vector is too short, allocate one
KW> twice as long and copy all the elements into it.
KW> Without very special purpose and expensive hardware for
KW> RAM there isn't any much better way to do it.
As i can see, this is not always correct. Glibc use mmap() in
malloc() for some big chunks (>= 128kB by default) and mremap()
for realloc(). Also it try to avoid malloc-copy-free if possible
for chunks allocated in regular memory.
??>> It`s intresting.. Go look how it implemented in perl..
KW> Oh, not today. Somebody else, who knows where to look, can
KW> go look and post a hundred words or less on what
KW> great idea is in there.
Ups.. Sorry.. :-)
--
DM, Dmitry Morozhnikov, PGPKEY 0xB6C14D95