Subject: Re: compile-file

From: Bruno Haible <[email-masked]>
Date: Fri, 25 Jun 1999 18:18:42 +0200 (MET DST)

[Message forwarded from Sam Steingold.]

>>>> In message <[email-masked]>
>>>> On the subject of "compile-file"
>>>> Sent on Fri, 25 Jun 1999 08:27:33 -0700 (PDT)
>>>> Honorable Josef Eschgfaeller <[email-masked]> writes:
 >> I'm looking for a very simple and quick method for compiling a collection
 >> of Lisp files.
 >> 
 >> (1) It seems that Clisp requires that source file names end with ".lsp".
 >>     Is there an option to override this?

(apropos "file-type")

will give you `system::*source-file-types*'

 >> (2) Can one link the object files to an executable program?

see ftp://cellar.goems.com/pub/clisp/impnotes.html#app-dev

 >> (3) Is there someone who has made a little makefile for all this?

you can use defsystem.lsp from your favorite lisp archive or
        http://www.goems.com/~sds/data/cllib.zip 
        http://www.goems.com/~sds/software.html 
I have a makefile for lisps and a simple make implemented in lisp.

 >> I'm rather new to Lisp, especially to everything which has to do
 >> with efficiency, implementation or compilation. For functions as the
 >> following
 >> 
 >> (defun numbers (a b &optional (d 1))
 >> (do ((x a (+ x d)) (li nil))
 >> ((> x b) (nreverse li)) (push x li)))

I would write this as

(loop for x from a to b by d collect x)

 >> with compile-file or compiling this single function I obtain an
 >> improvement in speed by a factor 10, say. This is not so bad, but
 >> can one hope for better with a correct compilation technique?

You should concentrate on using a better algorithm and forget the
micro-optimizations. 

I use the declaration 

 (declaim (optimize (speed 3) (space 0) (safety 3) (debug 3)))

note that it will make no difference in CLISP (and probably little
difference in ACL and CMUCL since this sets safety and debug to high
values; to get CMUCL execute your double floats faster than C, use
 (declaim (optimize (speed 3) (space 0) (safety 0) (debug 0)))
please note that you probably do NOT really need this kind of speed).

-- 
Sam Steingold (http://www.goems.com/~sds) running RedHat6.0 GNU/Linux
Micros**t is not the answer.  Micros**t is a question, and the answer is Linux,
(http://www.linux.org) the choice of the GNU (http://www.gnu.org) generation.
Hard work has a future payoff.  Laziness pays off NOW.