[Openmcl-devel] Effects of optimization settings

R. Matthew Emerson rme at clozure.com
Tue Apr 7 04:17:19 UTC 2009


On Apr 6, 2009, at 11:37 PM, Osei Poku wrote:

> Hello,
>
> Are there any guidelines on the effects that the various optimization
> settings have on the compiler?

There's http://trac.clozure.com/openmcl/wiki/DeclareOptimize but that  
may be more than you really wanted to know.


>  After playing with them for a while,
> I'm not convinced that some settings have any effect (esp. (speed
> 3)).  The output of disassemble looks exactly the same for the
> following functions.
>
> (defun mathop (i j)
>    (1+ (ash i j)))
>
> and..
>
> (defun mathop-fast (i j)
>    (declare (optimize (speed 3) (safety 0) (debug 0)) (fixnum i j))
>    (1+ (ash i j)))

You have to tell the compiler that the results of those operations  
will be fixnums as well (if you know that's going to be case, that is).

CCL> (defun mathop (i j)
        (declare (optimize (speed 3) (safety 0)) (fixnum i j))
        (the fixnum (1+ (the fixnum (ash i j)))))
MATHOP
CCL> (df *)
   [0]     (recover-fn)
   [5]     (pushl (% ebp))
   [6]     (movl (% esp) (% ebp))
   [8]     (pushl (% arg_y))
   [9]     (pushl (% arg_z))
   [10]    (movl (@ -4 (% ebp)) (% arg_y))
   [13]    (movl (@ -8 (% ebp)) (% arg_z))
   [16]    (calll (@ .SPBUILTIN-ASH))
   [23]    (recover-fn)
   [28]    (addl ($ 4) (% arg_z))
   [31]    (leavel)
   [32]    (retl)






More information about the Openmcl-devel mailing list