Clozure CLのLispの部分をコンパイルしてうんたらかんたらして起動とかを早くする。
? (ccl:compile-ccl)
フィボナッチ数の20番目を計算してテスト
#!/bin/sh #|-*- mode:lisp -*-|# #| <Put a one-line description here> exec ros -Q -- $0 "$@" |# (progn ;;init forms (ros:ensure-asdf) ;;#+quicklisp (ql:quickload '() :silent t) ) (defpackage :ros.script.fib.3691033179 (:use :cl)) (in-package :ros.script.fib.3691033179) (defun fib (n) (case n ((0 1) 1) (t (+ (fib (- n 1)) (fib (- n 2)))))) (defun main (&rest argv) (declare (ignorable argv)) (princ (fib 20)) (terpri)) ;;; vim: set ft=lisp lisp:
起動時間も見たいのでRoswell scriptで
$ ros build fib.ros $ #ビルド前 $ time ./fib.ros 10946 ./fib.ros 1.51s user 0.14s system 98% cpu 1.671 total $ #ビルド後 $ time./fib.ros 10946 ./fib.ros 0.37s user 0.09s system 96% cpu 0.482 total