Hi Dave!
On Mon, 20 Oct 2003 18:34:54 +0100, David Fox <davef@xanalys.com> wrote:
> Start collecting data. This should always be the first step when
> addressing any GC-related problem.
Yes, I did that already. That was where my "layman analysis" came
from.
> Use periodic calls to (ROOM), or intersperse these calls in your
> large form.
That won't help because the problem happens at read time.
> It sounds like there is a self-contained test case: if so, we want
> to see that as well.
I had a test case which was too complicated but know I have one which
is rather simple. Below is a file "foo.lisp". Compile it and load it,
then evaluate, say, (TEST 1000). On my machine (LW 4.2.7 pro Linux) I
get these results:
---------------
Starting test 1
---------------
Timing the evaluation of (LOAD "foo-test-1.lisp")
; Loading text file /home/edi/cl-interpol/foo-test-1.lisp
user time = 0.613
system time = 0.000
Elapsed time = 0:00:01
Allocation = 69424 bytes standard / 22035288 bytes fixlen
0 Page faults
Generation 0: Total Size 524K, Allocated 233K, Free 282K
Generation 1: Total Size 2754K, Allocated 173K, Free 2564K
Generation 2: Total Size 2198K, Allocated 1143K, Free 1046K
Generation 3: Total Size 17529K, Allocated 17053K, Free 459K
Total Size 23002K, Allocated 18604K, Free 4352K
Generation 0: Total Size 524K, Allocated 24K, Free 491K
Generation 1: Total Size 2754K, Allocated 173K, Free 2564K
Generation 2: Total Size 2198K, Allocated 1143K, Free 1046K
Generation 3: Total Size 17529K, Allocated 17053K, Free 459K
Total Size 23002K, Allocated 18395K, Free 4561K
---------------
Starting test 2
---------------
Timing the evaluation of (LOAD "foo-test-2.lisp")
; Loading text file /home/edi/cl-interpol/foo-test-2.lisp
user time = 15.468
system time = 0.050
Elapsed time = 0:00:15
Allocation = 70168 bytes standard / 22035343 bytes fixlen
0 Page faults
Generation 0: Total Size 524K, Allocated 265K, Free 250K
Generation 1: Total Size 24258K, Allocated 21037K, Free 3088K
Generation 2: Total Size 2198K, Allocated 1635K, Free 554K
Generation 3: Total Size 17529K, Allocated 17053K, Free 459K
Total Size 44506K, Allocated 39992K, Free 4352K
Generation 0: Total Size 524K, Allocated 70K, Free 445K
Generation 1: Total Size 24258K, Allocated 1473K, Free 22652K
Generation 2: Total Size 2198K, Allocated 1143K, Free 1046K
Generation 3: Total Size 17529K, Allocated 17053K, Free 459K
Total Size 44506K, Allocated 19741K, Free 24603K
I think this matches my assumption from my initial email. Note how in
the first test generations 1 to 3 haven't changed while in the second
test almost 20MB went into generation 1, and generation 2 also grew a
bit. Also note the timing difference (a factor of 25) although the
files differ only in two lines.
Does that suffice?
Cheers,
Edi.
------------------ foo.lisp -------------------
(defun cons-a-lot (n)
(if (zerop n)
(list 'progn)
`(progn ,(cons-a-lot (1- n)))))
(defun foo-reader (stream char arg)
(declare (ignore arg char))
(cons-a-lot
(* 100
(loop for char = (peek-char nil stream t nil t)
while (alphanumericp char)
do (read-char stream t nil t)
count t))))
(defun test (n)
(set-dispatch-macro-character #\# #\? #'foo-reader)
(format t "~&---------------~%~
Starting test 1~%~
---------------~%")
(force-output)
(with-open-file (s "foo-test-1.lisp"
:direction :output
:if-exists :supersede)
(loop for i below n
do (format s "#?eeeeeeeeee~%")))
(hcl:mark-and-sweep 3)
(time (load "foo-test-1.lisp"))
(room)
(hcl:mark-and-sweep 3)
(room)
(format t "~&---------------~%~
Starting test 2~%~
---------------~%")
(force-output)
(with-open-file (s "foo-test-2.lisp"
:direction :output
:if-exists :supersede)
(format s "(progn~%")
(loop for i below n
do (format s "#?eeeeeeeeee~%"))
(format s ")~%"))
(hcl:mark-and-sweep 3)
(time (load "foo-test-2.lisp"))
(room)
(hcl:mark-and-sweep 3)
(room)
(set-dispatch-macro-character #\# #\? nil))
------------------ foo.lisp -------------------
Unable to parse email body. Email id is 1454