condとifってどっちを使うべきなんだろう。

最近少し疑問に思っていること。一夜漬けlispしか読んでいない自分的には殆ど知識もないので、適当に直ぐに思いつくifの方を使っていたけど、helpとかで見てもcondと違いがよく分からなかった。じゃあ早い方が良いなぁとか思って
速度考 TIPS (xyzzy[しょぼしょぼすくりぷと])
http://www2.ocn.ne.jp/~cheerful/script/xyzzy/tips/speed.html
ここを見て、さっき試していたののcondとifの速度を調べてみた。

;速度比較
(let ((st (get-internal-real-time)))

 (dotimes (i 10000)
  (cond (*parenthesis-complete-on*
		 (add-hook '*post-command-hook* 'parenthesis-complete)
		 (setq *parenthesis-complete-off* nil)
		 (message "parenthesis-complete on"))
		(t
		 (delete-hook '*post-command-hook* 'parenthesis-complete)
		 (setq *parenthesis-complete-off* t)
		 (message "parenthesis-complete off")))
   )

  (- (get-internal-real-time) st))
;実行結果
6600
6970

(let ((st (get-internal-real-time)))

 (dotimes (i 10000)
  (if *parenthesis-complete-on*
	  (progn
		(add-hook '*post-command-hook* 'parenthesis-complete)
		(setq *parenthesis-complete-off* nil)
		(message "parenthesis-complete on"))
	(progn
	  (delete-hook '*post-command-hook* 'parenthesis-complete)
	  (setq *parenthesis-complete-off* t)
	  (message "parenthesis-complete off")))
   )

  (- (get-internal-real-time) st))
;実行結果
1112
1102

かなりifが早い。けど、始めから付いてくるlispには結構condが使われている。条件が少ない場合でifの方が早いのかな。バイトコンパイルすると速度も相当変わるようなので、簡単にはいえないけど。ちなみに結果の時間がかかっているのは、単純にPCがヘタレだから。