From 7e833faf8aeac694236c60036d697d1141e0bf6a Mon Sep 17 00:00:00 2001 From: Henry Harrington Date: Thu, 16 Feb 2017 18:14:44 +0000 Subject: [PATCH] Inline FILL and provide a specialized path for vectors. --- system/sequence.lisp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/system/sequence.lisp b/system/sequence.lisp index f1287e4dc..a3239782d 100644 --- a/system/sequence.lisp +++ b/system/sequence.lisp @@ -469,10 +469,17 @@ (setf (elt sequence-1 (+ start1 i)) (elt sequence-2 (+ start2 i)))) sequence-1) +(declaim (inline fill)) (defun fill (sequence item &key (start 0) end) - (unless end (setf end (length sequence))) - (dotimes (i (- end start)) - (setf (elt sequence (+ i start)) item)) + (etypecase sequence + (list + (let ((end (or end (length sequence)))) + (dotimes (i (- end start)) + (setf (elt sequence (+ i start)) item)))) + (vector + (let ((end (or end (length sequence)))) + (dotimes (i (- end start)) + (setf (aref sequence (+ i start)) item))))) sequence) (defun map (result-type function first-sequence &rest more-sequences)