[asdf-devel] optimization settings

Faré fahree at gmail.com
Fri Mar 21 08:29:43 UTC 2014

For the record, the way we did in QRes was to proclaim appropriate
system-dependent settings in some perform :around methods
Look for proclaim in quux/lisp/qres-build/qres-build.lisp and
in the released quux tarball.

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
Politicians are like diapers: they must be changed often.
And for the same reasons. [Also, adults don't need either of them. — Faré]

On Thu, Mar 20, 2014 at 8:20 AM, Robert Brown <robert.brown at gmail.com> wrote:
> Here's the problem I want solved.  A library author wants to
> compile some source files with high optimization settings.  How
> can this be done?  The author could put
>     (declaim (optimize ... ))
> at the top of those files, but then any code compiled later may
> accidentally get the new settings.  If my library depends on
> others, I don't want the act of compiling them to change whatever
> optimization settings I prefer.
> If ASDF is going to manage readtables, why doesn't it manage
> compiler optimization settings?  Maybe it should manage neither.
> Can the around method technique handle both?
> Bob
> On Wed, Mar 19, 2014 at 6:22 PM, Robert Goldman <rpgoldman at sift.net> wrote:
>> 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)))
>>     (call-next-method)))
>> I'd have to make sure that LOCALLY is going to do what I expect here....

More information about the asdf-devel mailing list