Previous: Multiple Lisps, Up: Setup Tuning

2.5.3 Loading Swank faster

For SBCL, we recommend that you create a custom core file with socket support and POSIX bindings included because those modules take the most time to load. To create such a core, execute the following steps:

     shell$ sbcl
     * (mapc 'require '(sb-bsd-sockets sb-posix sb-introspect sb-cltl2 asdf))
     * (save-lisp-and-die "sbcl.core-for-slime")

After that, add something like this to your .emacs:

     (setq slime-lisp-implementations
           '((sbcl ("sbcl" "--core" "sbcl.core-for-slime"))))

For maximum startup speed you can include the Swank server directly in a core file. The disadvantage of this approach is that the setup is a bit more involved and that you need to create a new core file when you want to update SLIME or SBCL. The steps to execute are:

     shell$ sbcl
     * (load ".../slime/swank-loader.lisp")
     * (swank-loader:dump-image "sbcl.core-with-swank")

Then add this to your .emacs:

     (setq slime-lisp-implementations
           '((sbcl ("sbcl" "--core" "sbcl.core-with-swank")
                   :init (lambda (port-file _)
                           (format "(swank:start-server %S)\n" port-file)))))

Similar setups should also work for other Lisp implementations.