;;; As a simple example of SIMD optimizations using SBCL ... ;;; ... compare disassembly and speed of the following (defun deep-copy-1 (source destination) (declare (type (simple-array s32) source destination)) ;; "Naive" solution (dotimes (index (array-total-size source)) (setf (aref destination index) (aref source index)))) (defun deep-copy-2 (source destination &aux (length (array-total-size source))) ;; This should enforce a bounds check; otherwise it is not functionally ;; equivalent to DEEP-COPY-1. You may have to use an ASSERT instead. (declare (type (simple-array s32 (length)) source destination)) ;; Using SB-SIMD (do-vectorized (index 0 length) (setf (s32-row-major-aref destination index) (s32-row-major-aref source index))))