chiark / gitweb /
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 44e0f135efecdf84118703cf4143daef6dbb8768..a66409aa6cc678609bf64793a0f7a88e3d3988ef 100644 (file)
@@ -5,4 +5,5 @@ test.log
 *.o
 *.exe
 *.hi
+*.core
 *-fringe
index 8ea4f74dc5408ae11c0c417ea6e394204d86f126..86e5616b4196e2f31df5d0ac61cc76be49875b2f 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 0081ee3c2139cbfdaa16eabff25988dd704a71b5..7386c381529a0e6256e5cd8b6899ba0e2bcdba78 100644 (file)
@@ -95,16 +95,17 @@ (defun main (args)
                                       (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 --------------------------------------------------