Subject: Re: CLISP vs. CMUCL vs. SBCL
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 11 Feb 2004 08:05:21 -0600
Newsgroups: comp.lang.lisp
Message-ID: <jV2dnUXPiJs8q7fdXTWc-w@speakeasy.net>
Thomas F. Burdick <tfb@famine.OCF.Berkeley.EDU> wrote:
+---------------
| Pascal Bourguignon <spam@thalassa.informatimago.com> writes:
| > Posix forks are more portable than threads in common-lisp. But they're
| > less efficient.  I guess that  because of garbage collection, the heap
| > is more dynamic, even for the "library" part. Everything ends up being
| > copied.
| 
| With CMUCL and SBCL, the "standard library" isn't touched, so it's
| shared between processes.  The origin of this is so that on platforms
| using the two-space copying collector, you don't have to copy all of
| Common Lisp on every GC.
+---------------

And the result of *that*, at least on operating systems whose VM systems
do a good job of cacheing executables and mmap'd file [FreeBSD, for one,
and I suspect Linux as well], is that successive executions of CMUCL
(and, presumably, SBCL, though I haven't tried it yet) from the shell
are very fast -- ~20 milliseconds on a typical 1.5 GHz platform [note
that the CPU time appears to move around between user-mode and "system"
time, though the sum seems constant]:

	% time cmucl -noinit -eval '(progn (format t "hello world~%") (quit))'
	hello world
	0.016u 0.000s 0:00.01 100.0%    168+3436k 0+0io 0pf+0w
	% time cmucl -noinit -eval '(progn (format t "hello world~%") (quit))'
	hello world
	0.008u 0.008s 0:00.01 0.0%      0+0k 0+0io 0pf+0w
	2% time cmucl -noinit -eval '(progn (format t "hello world~%") (quit))'
	hello world
	0.011u 0.005s 0:00.01 100.0%    252+3620k 0+0io 0pf+0w
	% 

This makes CMUCL quite usable (IMHO) for "shell scripting" and
light-load CGI scripting, and I've been using it very happily for
such things for some time now.[1] In fact, on the same platform,
it's actually slightly faster than CLISP!

	% time clisp -norc -x '(progn (format t "hello world~%") (quit))'
	hello world
	0.024u 0.000s 0:00.02 100.0%    3570+2182k 0+0io 0pf+0w
	% time clisp -norc -x '(progn (format t "hello world~%") (quit))'
	hello world
	0.016u 0.008s 0:00.02 50.0%     7140+6168k 0+0io 0pf+0w
	% time clisp -norc -x '(progn (format t "hello world~%") (quit))'
	hello world
	0.006u 0.018s 0:00.02 50.0%     7728+5140k 0+0io 0pf+0w
	% 


-Rob

[1] Though I do use a "mod_lisp"-like persistent CMUCL process for any
    "heavy lifting" middleware.

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607