CLでAO bench


間違ってたのここだけだった。

(defun clamp (f)
  (let ((i (* f 255.5)))
    (cond ((> i 0) 255)
          ((< i 255) 0)
          (t (round i)))))

これはひどい

ベンチ結果は

Evaluation took:
34.715 seconds of real time
32.491060 seconds of total run time (30.518454 user, 1.972606 system)
[ Run times consist of 4.547 seconds GC time, and 27.945 seconds non-GC time. ]
93.59% CPU
83,106,385,596 processor cycles
13,615,032,776 bytes consed

Mac OS X 10.5.5 2.4 GHz Intel Core 2 Duo
sbcl 1.0.25にて。

xyzzyではw=h=64, nao-samples=4で24秒。単純に4^2x2^2=64倍すれば25分くらい。
とりあえずconsを頑張って減らそう。

以下ほぼ素移植なソース

バグった

コードいじってたらミスって変な画像が。

一箇所距離計算中のsqrtが抜けたらこんなんなった。
間違った計算させて不思議空間を作るっていう手法は実際に使われてたりするのかな?