[slime-devel] [PATCH] add optimization settings menu

Klaus Weidner kw at w-m-p.com
Tue Sep 13 21:00:43 UTC 2005


Hello,

this patch adds menu options for changing the optimization settings in
the lisp global environment. This way, you can recompile things for
improved debuggability or speed without having to put declaims or
declares in your source file. At least with sbcl, the proclaim call
affects following compilations, but the compiled code can still override
the global settings with decaim/declare.

I know that this is just a quick hack, and I'm sure there's a more
elegant way to configure global properties for the lisp environment, so
please consider this as a proof of concept and not necessarily something
for applying...

-Klaus

===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.544
diff -u -r1.544 slime.el
--- slime.el	13 Sep 2005 05:37:16 -0000	1.544
+++ slime.el	13 Sep 2005 20:46:52 -0000
@@ -780,6 +780,10 @@
        [ "Check Parens"            check-parens t]
        [ "Update Indentation"      slime-update-indentation ,C]
        [ "Select Buffer"           slime-selector t])
+      ("Optimization"
+       [ "Max Debug"               slime-optimize-max-debug ,C ]
+       [ "High Speed"              slime-optimize-high-speed ,C ]
+       [ "Unsafe Speed"            slime-optimize-unsafe-speed ,C ])
       ("Profiling"
        [ "Toggle Profiling..."     slime-toggle-profile-fdefinition ,C ]
        [ "Profile Package"         slime-profile-package ,C]
@@ -6304,6 +6308,21 @@
                                           (buffer-file-name)))))))
   (let ((lisp-filename (slime-to-lisp-filename (expand-file-name filename))))
     (slime-eval-with-transcript `(swank:load-file ,lisp-filename))))
+
+
+;;;; Optimization
+
+(defun slime-optimize-max-debug ()
+  (interactive)
+  (slime-eval-async '(cl:proclaim '(cl:optimize (cl:debug 3) (cl:speed 0) (cl:safety 3)))))
+
+(defun slime-optimize-high-speed ()
+  (interactive)
+  (slime-eval-async '(cl:proclaim '(cl:optimize (cl:debug 0) (cl:speed 3) (cl:safety 3)))))
+
+(defun slime-optimize-unsafe-speed ()
+  (interactive)
+  (slime-eval-async '(cl:proclaim '(cl:optimize (cl:debug 0) (cl:speed 3) (cl:safety 0)))))
 
 
 ;;;; Profiling



More information about the slime-devel mailing list