From: Nathan Froyd Date: Wed, 15 Nov 2006 16:19:56 +0000 (+0000) Subject: 0.9.18.53: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=dccd283c6fedf7fe61d2d2bede328a6b7d92f7be;p=sbcl.git 0.9.18.53: Optimize MAP and MAP-INTO with vector arguments. * Introduce new optimization quality, INSERT-ARRAY-BOUNDS-CHECKS; * Use it in the %MAP and MAP-INTO transforms. (We needed something more fine-grained than (SAFETY 0), because we still want any necessary type-checking to take place. But we know that eliminating the bounds checks are safe.) --- diff --git a/NEWS b/NEWS index b685d71..9455b9a 100644 --- a/NEWS +++ b/NEWS @@ -36,6 +36,8 @@ changes in sbcl-0.9.19 (1.0.0?) relative to sbcl-0.9.18: incompatible element types (thanks to Mario Mommer) * optimization: method calls with &OPTIONAL or &KEY arguments are faster and don't cause extra consing + * optimization: MAP and MAP-INTO are significantly faster on vectors + whose elements types have been declared. * Improvements to the Windows port: ** floating point exceptions are now reported correctly. ** stack exhaustion detection works partially. diff --git a/src/compiler/array-tran.lisp b/src/compiler/array-tran.lisp index fd4e9a9..ee40d89 100644 --- a/src/compiler/array-tran.lisp +++ b/src/compiler/array-tran.lisp @@ -543,7 +543,7 @@ ;;; compile-time or we are generating unsafe code, don't bother with ;;; the VOP. (deftransform %check-bound ((array dimension index) * * :node node) - (cond ((policy node (and (> speed safety) (= safety 0))) + (cond ((policy node (= insert-array-bounds-checks 0)) 'index) ((not (constant-lvar-p dimension)) (give-up-ir1-transform)) diff --git a/src/compiler/policies.lisp b/src/compiler/policies.lisp index 78759f4..3bcdcaa 100644 --- a/src/compiler/policies.lisp +++ b/src/compiler/policies.lisp @@ -87,3 +87,7 @@ 3 0) ("no" "no" "no" "yes")) + +(define-optimization-quality insert-array-bounds-checks + (if (= safety 0) 0 3) + ("no" "yes" "yes" "yes")) diff --git a/src/compiler/seqtran.lisp b/src/compiler/seqtran.lisp index 0ce0497..57a9d0f 100644 --- a/src/compiler/seqtran.lisp +++ b/src/compiler/seqtran.lisp @@ -153,7 +153,8 @@ (tests `(endp ,index)))) ((csubtypep type (specifier-type 'vector)) (process-vector `(length ,seq-name)) - (places `(aref ,seq-name index))) + (places `(locally (declare (optimize (insert-array-bounds-checks 0))) + (aref ,seq-name index)))) (t (give-up-ir1-transform "can't determine sequence argument type")))) @@ -261,7 +262,8 @@ :result '(when (array-has-fill-pointer-p result) (setf (fill-pointer result) index)) :into 'result - :body '(setf (aref result index) funcall-result)) + :body '(locally (declare (optimize (insert-array-bounds-checks 0))) + (setf (aref result index) funcall-result))) result))) diff --git a/version.lisp-expr b/version.lisp-expr index 72f3f96..d63745c 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.18.52" +"0.9.18.53"