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 ...
Bob
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....
On Wed, 2014-03-19 at 17:22 -0500, Robert Goldman 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)))
LOCALLY has lexical scope.
Managing scoped optimizations seems like something that should be at least partly handled by a CDR, if anyone pays any attention to those.
It would be great if there was an expression, common to most CL implementations, that we could wrap around a call to COMPILE-FILE in order to impose an optimization policy.
Please create a launchpad ticket for this feature request. If it turns out NOT to be possible to get a uniform interface, this would be a place where we could drop descriptions of implementation-SPECIFIC approaches to localized control of optimization, suitable for an eventual new ASDF feature.
Best, R
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@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....
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 quux/lisp/qres-build/enhance-asdf.lisp 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@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@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....
On Wed, Mar 19, 2014 at 5:54 PM, Robert Brown robert.brown@gmail.com wrote:
Does ASDF set compiler optimization settings before compiling each file when building?
Not by default, though you can teach it to.
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.
And indeed, I seem to remember that SBCL made it local, but CCL global, and that it was affecting our build at ITA, and QRes had its own way of resetting it before every compilation.
The issue is similar to that of readtables ...
Indeed it is, though at least the optimization is supposed not to modify the semantics of correct programs.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org He has the first half of the Golden Rule down pat: Do unto others. — John McCarthy