Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech!howland.reston.ans.net!news.sprintlink.net!peernews.demon.co.uk!btnet!uknet!festival!edcogsci!jeff
From: jeff@aiai.ed.ac.uk (Jeff Dalton)
Subject: getting the right optimize declarations for various CLs
Message-ID: <D400M3.1n8@cogsci.ed.ac.uk>
Sender: usenet@cogsci.ed.ac.uk (C News Software)
Nntp-Posting-Host: bute-alter.aiai.ed.ac.uk
Organization: AIAI, University of Edinburgh, Scotland
References: <3hdo2d$bqa@eurybia.rz.uni-konstanz.de> <KANDERSO.95Feb12124216@bitburg.bbn.com>
Date: Tue, 14 Feb 1995 16:32:26 GMT
Lines: 49

In article <KANDERSO.95Feb12124216@bitburg.bbn.com> kanderso@bitburg.bbn.com (Ken Anderson) writes:
>
>   Do people have any suggestion about how to set the various optimize
>   qualities for use-only systems like CLM and for the system currently
>   being developed? Does it indeed change the size of the core and
>   execution speed largely?

>I do not recommend global use of high optimization settings, such as
>
> (optimize (speed 3) (safety 0) (debug 0))
>
>even in "use-only libraries", because if the library is reasonably
>optimized to begin with, it is likely not to help much (2-3%, say).  Also,
>you probably don't want the top level library interface to have this
>optmization setting because argument number checking would not be done
>which would cause strange bugs for your students.

I agree.  Stay away from (safety 0) unless you've read the
documentation for the implementation you're using and know
it's not going to go too far.  

>At lower settings, CMU will verify your declarations, while at higher ones
>it will honor them without any runtime checks.  I have found that
>
> (optimize (speed 3) (safety 1) (debug 0))
>
>has worked well for me in several Lisps.  It provides argument checking and
>optimized code.  I'm not sure if this is the best one for CMU.

I think your recommendation is a good one, but what I actually
use (with very good results) in Lucid CL is this:

  (proclaim '(optimize (compilation-speed 0)    ;production mode
                       (speed 2)                ;tail-merge off
                       (safety 0)))             ;no arity or r/w arg checks

(speed 3) would have done tail-merging which I thought might be a
pain when debugging.

In Allegro 4.1, I used:

(proclaim '(optimize (speed 3)
                     (safety 1)         ;still check for interrupts
                     (space 0)
                     (debug 0)))

This was a case where (safety 0) did more than I wanted.

-- jeff
