#+akcl (use-package "PCL") ; #+gcl (lisp::allocate-relocatable-pages 2000) (proclaim '(optimize (safety 0)(speed 3)(space 0) (compilation-speed 0)(debug 0) (fixnum-safety 0)(interruptable 0))) (defconstant *n* #.(* 128 1024))) ;;; An Array of two dimensions, [*n][3] ;;; these are three vectors, the first two are filled up, ;;; the benchmark is to construct the third vector from ;;; some simple arithmetic. (defun bilde-array () (let ((res (make-array '(3 #.*n*) :element-type 'double-float ))) (declare (type (simple-array double-float (3 #.*n*)) res)) (dotimes (i #.*n*) (declare (type fixnum i)) (setf (aref res 0 i) (coerce i 'double-float)) (setf (aref res 1 i) (coerce (- #.*n* i) 'double-float))) res )) (defun rechne (res) (declare (type (simple-array double-float (3 #.*n*)) res)) (dotimes (i #.*n*) (declare (type fixnum i)) (setf (aref res 2 i) (* (+ (aref res 0 i) (aref res 1 i)) (aref res 0 i)) )) res) (defun test () (let ((foo (bilde-array))) (time (dotimes (i 10) (rechne foo)))) nil)