[cmucl-imp] Interesting loop problem
Raymond Toy
toy.raymond at gmail.com
Thu Aug 6 15:23:17 UTC 2015
>>>>> "Blake" == Blake McBride <blake1024 at gmail.com> writes:
Blake> Greetings,
Blake> I was running some test code to (stupid) test the speed of various lisp
Blake> implementation including those other than CL. The code I used is as
Blake> follows:
Blake> (defun count2 (n)
Blake> (prog ((i 0))
Blake> loop
Blake> (and (eql i n) (return))
Blake> (setq i (+ i 1))
Blake> (go loop)))
Blake> I know the code is terrible, but it was a bit more portable over various
Blake> lisp dialects. It ran fine on CLISP, SBCL, ABCL, CCL, GCL, ECL, and
Blake> LISPF4, but not CMUCL.
Blake> CMUCL ran the code compiled but not interpreted.
Blake> Try this interpreted: (count2 80000000) ; 80M
Blake> I get:
Blake> ; [GC threshold exceeded with 12,013,152 bytes in use. Commencing GC.]
Blake> ; [GC completed with 106,440 bytes retained and 11,906,712 bytes freed.]
Blake> ; [GC will next occur when at least 12,106,440 bytes are in use.]
Blake> ; [GC threshold exceeded with 12,122,352 bytes in use. Commencing GC.]
Blake> ; [GC completed with 114,616 bytes retained and 12,007,736 bytes freed.]
Blake> ; [GC will next occur when at least 12,114,616 bytes are in use.]
Blake> ; [GC threshold exceeded with 12,124,080 bytes in use. Commencing GC.]
Blake> .....
Blake> I am running 20F on Linux.
And? Are you saying it never finishes? Are you complaining about the
constant stream of GC messages?
FWIW, on my Ubuntu machine, your example does finish. It takes a while
though (64 sec). The compiled (native) version takes .45 sec; the
byte-compiled version takes 40 sec.. I guess the interpreter isn't
very efficient in this case.
--
Ray
More information about the cmucl-imp
mailing list