From: Nathan F. <nf...@us...> - 2012-12-20 04:57:22
|
The branch "master" has been updated in SBCL: via a1019cb2ccde131d2466f2d70076a00059e3c71d (commit) from 053e401f08f5df876707453960f8034661553d05 (commit) - Log ----------------------------------------------------------------- commit a1019cb2ccde131d2466f2d70076a00059e3c71d Author: Nathan Froyd <fr...@gm...> Date: Wed Dec 19 23:10:42 2012 -0500 lazily compute MIN-EXTENSION for VECTOR-PUSH-EXTEND This change avoids a full call to LENGTH on every call to VECTOR-PUSH-EXTEND. --- src/code/array.lisp | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/code/array.lisp b/src/code/array.lisp index 0d44b09..8a4ddfe 100644 --- a/src/code/array.lisp +++ b/src/code/array.lisp @@ -836,18 +836,17 @@ of specialized arrays is supported." (setf (%array-fill-pointer array) (1+ fill-pointer)) fill-pointer)))) -(defun vector-push-extend (new-element - vector - &optional - (min-extension - (let ((length (length vector))) - (min (1+ length) - (- array-dimension-limit length))))) - (declare (fixnum min-extension)) +(defun vector-push-extend (new-element vector &optional min-extension) + (declare (type (or null fixnum) min-extension)) (let ((fill-pointer (fill-pointer vector))) (declare (fixnum fill-pointer)) (when (= fill-pointer (%array-available-elements vector)) - (adjust-array vector (+ fill-pointer (max 1 min-extension)))) + (let ((min-extension + (or min-extension + (let ((length (length vector))) + (min (1+ length) + (- array-dimension-limit length)))))) + (adjust-array vector (+ fill-pointer (max 1 min-extension))))) ;; disable bounds checking (locally (declare (optimize (safety 0))) (setf (aref vector fill-pointer) new-element)) ----------------------------------------------------------------------- hooks/post-receive -- SBCL |