;;; fast: with optimization declarations and THE CL-USER> (defun test () (declare (optimize speed (safety 0))) (let ((foo (make-array (* 1024 1024 10) :element-type '(unsigned-byte 8)))) (with-open-file (s "/dev/zero" :element-type '(unsigned-byte 8)) (time (read-sequence foo s))) (time (the (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)) (copy-seq (the (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)) foo)))) nil)) STYLE-WARNING: redefining TEST in DEFUN TEST CL-USER> (test) Evaluation took: 0.014 seconds of real time 0.008001 seconds of user run time 0.008 seconds of system run time 0 calls to %EVAL 0 page faults and 40,960 bytes consed. Evaluation took: 0.014 seconds of real time 0.016001 seconds of user run time 0.0 seconds of system run time 0 calls to %EVAL 0 page faults and 10,485,776 bytes consed. NIL ;;; slow: with optimization declarations, but without THE CL-USER> (defun test () (declare (optimize speed (safety 0))) (let ((foo (make-array (* 1024 1024 10) :element-type '(unsigned-byte 8)))) (with-open-file (s "/dev/zero" :element-type '(unsigned-byte 8)) (time (read-sequence foo s))) (time (copy-seq foo)) nil)) ; in: LAMBDA NIL ; (COPY-SEQ FOO) ; ; note: unable to ; optimize ; due to type uncertainty: ; The result is a (VALUES (OR (SIMPLE-ARRAY * (*)) (AND SEQUENCE (NOT VECTOR))) ; &OPTIONAL), not a (VALUES ; (SIMPLE-ARRAY (UNSIGNED-BYTE 8) ; (*)) ; &REST T). ; ; compilation unit finished ; printed 1 note STYLE-WARNING: redefining TEST in DEFUN TEST CL-USER> (test) Evaluation took: 0.022 seconds of real time 0.012001 seconds of user run time 0.008 seconds of system run time 0 calls to %EVAL 0 page faults and 45,056 bytes consed. Evaluation took: 0.989 seconds of real time 0.976061 seconds of user run time 0.012001 seconds of system run time [Run times include 0.02 seconds GC run time.] 0 calls to %EVAL 0 page faults and 10,497,440 bytes consed. NIL CL-USER>