cl: Dump a core image to improve startup times.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 17 Nov 2009 23:33:52 +0000 (23:33 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 17 Nov 2009 23:33:52 +0000 (23:33 +0000)
This is cheating: the core image is massive because SBCL doesn't tree-
shake.

.gitignore
Makefile
cl-fringe.lisp

index 44e0f13..a66409a 100644 (file)
@@ -5,4 +5,5 @@ test.log
 *.o
 *.exe
 *.hi
+*.core
 *-fringe
index 8ea4f74..86e5616 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -84,9 +84,12 @@ icon-fringe: icon-fringe.icn
 ###--------------------------------------------------------------------------
 ### Common Lisp.
 
+CLEANFILES             += *.core
+
 LANGS                  += cl
 cl-fringe: cl-fringe.lisp
-       cl-launch -R -o $@ -f `pwd`/$^
+##     cl-launch -R -o $@ -f `pwd`/$^  -- slow to start
+       cl-launch -o $@ -f `pwd`/$^ +I -r launch -d $@.core
 
 ###--------------------------------------------------------------------------
 ### F#.
index 0081ee3..7386c38 100644 (file)
                                       (iterate-fringe (parse-tree b))))))))
 
 #+cl-launch
-(flet ((bail (format args)
-        (format *error-output* "~A: ~?~%"
-                (cl-launch:getenv "CL_LAUNCH_FILE") format args)
-        (cl-launch:quit 1)))
-  (handler-case
-      (main cl-launch:*arguments*)
-    (simple-error (err)
-      (bail (simple-condition-format-control err)
-           (simple-condition-format-arguments err)))
-    (error (err)
-      (bail "~A" err))))
+(defun launch ()
+  (flet ((bail (format args)
+          (format *error-output* "~A: ~?~%"
+                  (cl-launch:getenv "CL_LAUNCH_FILE") format args)
+          (cl-launch:quit 1)))
+    (handler-case
+       (main cl-launch:*arguments*)
+      (simple-error (err)
+       (bail (simple-condition-format-control err)
+             (simple-condition-format-arguments err)))
+      (error (err)
+       (bail "~A" err)))))
 
 ;;;----- That's all, folks --------------------------------------------------