[asdf-devel] optimization settings

Robert Goldman rpgoldman at sift.net
Wed Mar 19 22:22:03 UTC 2014

Robert Brown wrote:
> Does ASDF set compiler optimization settings before compiling
> each file when building?  I'm concerned that changing the
> optimization setting inside one source file could cause the
> change to stick and be used for other files.  I don't think the
> CL standard mandates that "(declaim (optimize ... ))" applies
> only to the current file.
> The issue is similar to that of readtables ...

To the best of my knowledge (i.e., I'm not looking it up again right now!) you are right that the standard does not mandate file-scope for DECLAIM, and I have a *vague* memory that some implementation does allow it to leak. 

I am reluctant to add this to the set of things that ASDF (mis)manages for the programmer.  E.g, I think SBCL has a "policy" setting that is intended to provide a default setting for the optimization parameters.

However, you COULD do this yourself, I believe, by writing an :AROUND method for PERFORM COMPILE-OP on your own system.  I'm actually not sure what the right mechanism is.  Would it be:

(defmethod perform :around ((op compile-op) (c my-optimized-files))
  (locally (declare (optimize (speed 3) (good-looking 11)))

I'd have to make sure that LOCALLY is going to do what I expect here....

More information about the asdf-devel mailing list