From: Nikodemus S. <de...@us...> - 2011-04-07 13:05:05
|
Update of /cvsroot/sbcl/sbcl/src/compiler In directory vz-cvs-3.sog:/tmp/cvs-serv5672/src/compiler Modified Files: seqtran.lisp Log Message: 1.0.47.14: optimize list DELETE to DELQ in more cases Optimize in the presence of explicit EQL test if the item is known to be such that EQ and EQL work the same. Optimize for implicit EQL for fixnums as well -- not just non-numbers as previously. Index: seqtran.lisp =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/compiler/seqtran.lisp,v retrieving revision 1.113 retrieving revision 1.114 diff -u -d -r1.113 -r1.114 --- seqtran.lisp 7 Nov 2010 01:14:39 -0000 1.113 +++ seqtran.lisp 7 Apr 2011 13:05:01 -0000 1.114 @@ -482,21 +482,11 @@ ;;; almost as fast as MEMQ. (deftransform delete ((item list &key test) (t list &rest t) *) "convert to EQ test" - ;; FIXME: The scope of this transformation could be - ;; widened somewhat, letting it work whenever the test is - ;; 'EQL and we know from the type of ITEM that it #'EQ - ;; works like #'EQL on it. (E.g. types FIXNUM, CHARACTER, - ;; and SYMBOL.) - ;; If TEST is EQ, apply transform, else - ;; if test is not EQL, then give up on transform, else - ;; if ITEM is not a NUMBER or is a FIXNUM, apply - ;; transform, else give up on transform. - (cond (test - (unless (lvar-fun-is test '(eq)) - (give-up-ir1-transform))) - ((types-equal-or-intersect (lvar-type item) - (specifier-type 'number)) - (give-up-ir1-transform "Item might be a number."))) + (let ((type (lvar-type item))) + (unless (or (and test (lvar-fun-is test '(eq))) + (and (eq-comparable-type-p type) + (or (not test) (lvar-fun-is test '(eql))))) + (give-up-ir1-transform))) `(delq item list)) (deftransform delete-if ((pred list) (t list)) |