19
19
there isn't a cleaner and non-VM-specific way of doing things.
22
\section{Performance change}
23
Camm has identified a performace problem during compiles. There is
24
a loop that continually adds one element to a vector. This causes
25
the vector to get extended by 1 and copied. These patches fix the
26
problem since vectors with fill pointers don't need to be copied.
28
These cut out the lion's share of the gc problem
29
on this compile. 30min {\tt ->} 7 min on my box. There is still some gc
30
churning in cons pages due to many calls to 'list' with small n. One
31
can likely improve things further with an appropriate (declare
32
(:dynamic-extent ...)) in the right place -- gcl will allocate such
33
lists on the C stack (very fast).
35
\subsection{lengthenvec}
36
The original code was:
38
(defun lengthenvec (v n)
39
(if (adjustable-array-p v) (adjust-array v n)
40
(replace (make-array n) v)))
44
(defun lengthenvec (v n)
46
(and (array-has-fill-pointer-p v) (adjustable-array-p v))
48
(>= n (array-total-size v))
49
(adjust-array v (* n 2) :fill-pointer n)
51
(setf (fill-pointer v) n)
53
(replace (make-array n :fill-pointer t) v)))
56
\subsection{make-init-vector}
59
(defun make-init-vector (n val) (make-array n :initial-element val))
63
(defun make-init-vector (n val)
64
(make-array n :initial-element val :fill-pointer t))
24
69
;; Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.