[asdf-devel] optimization settings (retitled this topic)

Robert Goldman rpgoldman at sift.info
Thu Oct 29 19:18:40 UTC 2009


Tobias C. Rittweiler wrote:
> Robert Goldman writes:
> 
>> Fare wrote:
>>
>>>> Do we need a :after method to restore the old settings?  I'm not sure
>>>> how to do that actually, since I don't believe there's a portable way to
>>>> record them.  Do you have thoughts about this?
>>>>
>>> (rpg replied to me in private but I'm Cc'ing back the list)
>>>
>>> At ITA, we actually use a :around method with
>>>
>>> (defun call-with-local-compilation-settings (thunk)
>>>   (let
>>>       #+clozure
>>>       ((ccl::*nx-speed* ccl::*nx-speed*)
>>>         (ccl::*nx-space* ccl::*nx-space*)
>>>         (ccl::*nx-safety* ccl::*nx-safety*)
>>>         (ccl::*nx-cspeed* ccl::*nx-cspeed*)
>>>         (ccl::*nx-debug* ccl::*nx-debug*))
>>>       #+sbcl
>>>       ((sb-c::*policy* sb-c::*policy*))
>>>       #-(or clozure sbcl)
>>>       ()
>>>     (funcall thunk)))
>>>
>>> (defmacro with-local-compilation-settings (() &body body)
>>>   `(call-with-local-compilation-settings (lambda () , at body)))
>> Gary, got some Allegro fu that we could shovel into
>> with-local-compilation-settings?
> 
> A somewhat-portable way would be to query current optimization settings,
> and reset them appropriately. ("somewhat-portable" because the
> environment access stuff specified in CLtL2 allows for the querying.)
> 
> This way you also can easily define a default value for implementations
> where you do not (yet) know how to get that information from; my gut
> feeling for the default values would be (debug 2) (speed 2) (safety 2).

According to recent (8.1) allegro docs, the effects of DECLAIM should
not leak out of the current file, but I'm not sure that agrees with my
experience where optimization settings are concerned.  I have certainly
found what looks like leakage of optimization settings.

Franz recommends a default as follows:

;; For the most debuggable (and yet reasonably fast) code, use
;;
;;    (proclaim '(optimize (speed 2) (safety 1) (space 1) (debug 3)))

I can't find any documented solution to getting the current compiler
settings on ACL beyond calling (excl:explain-compiler-settings) and
parsing its output, but I imagine someone from Franz could find a better
solution.







More information about the asdf-devel mailing list