Hi,
I'm relatively new to Common Lisp. GCL has been my preferred CL platform
(over CMUCL and CLisp) because it generates portable C code and then calls a
compiler. I recently was trying to sum a large list of numbers using
reduce, and GCL took a very long time to compute the result. I'm trying to
understand why.
In GCL, it takes ~852 seconds to sum 200000 integers:
>(defun range (start end)
(loop for i from start below end collect i))
RANGE
>(progn
(setf *foo* (range 0 200000))
(length *foo*))
200000
(time (reduce #'+ *foo*))
real time : 852.200 secs
run-gbc time : 839.160 secs
child run time : 0.000 secs
gbc time : 0.100 secs
19999900000
In CLisp, the computation took less than a second:
[1]> (defun range (start end)
(loop for i from start below end collect i))
RANGE
[2]> (progn
(setf *foo* (range 0 200000))
(length *foo*))
200000
[3]> (time (reduce #'+ *foo*))
Real time: 0.109255 sec.
Run time: 0.108007 sec.
Space: 3107312 Bytes
GC: 3, GC time: 0.048003 sec.
19999900000
Why is this? (I'm running GCL (GNU Common Lisp) 2.6.8 ANSI Aug 2 2007
17:12:54 on Ubuntu Gutsy). How would I go about finding out the bottleneck
in gcl_seqlib.lsp?
Any advice would be much appreciated.
Thanks,
Bill Six
_______________________________________________
Gcl-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gcl-devel