From 527e43a1353207444070ee497de3079fc051fe40 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Wed, 23 Apr 2008 15:29:28 +0000 Subject: [PATCH] 1.0.16.5: faster ADJOIN in normal speed policies * Remore MAYBE-INLINE declaration, and add a compiler macro so that MEMBER transform is able to its job. --- NEWS | 2 ++ src/code/list.lisp | 11 +++++++++-- version.lisp-expr | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 1d33ffca1..fb96144aa 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ ;;;; -*- coding: utf-8; -*- changes in sbcl-1.0.17 relative to 1.0.16: + * optimization: ADJOIN and PUSHNEW are upto ~70% faster in normal + SPEED policies. * bug fix: dynamic extent allocation of nested lists and vectors could leak to otherwise accessible parts. * bug fix: invalid optimization of heap-allocated alien variable diff --git a/src/code/list.lisp b/src/code/list.lisp index ca4463235..8f6322684 100644 --- a/src/code/list.lisp +++ b/src/code/list.lisp @@ -19,7 +19,7 @@ (declaim (maybe-inline tree-equal nth %setnth nthcdr last last1 make-list append - nconc nconc2 member-if member-if-not tailp adjoin union + nconc nconc2 member-if member-if-not tailp union nunion intersection nintersection set-difference nset-difference set-exclusive-or nset-exclusive-or subsetp acons assoc-if assoc-if-not rassoc rassoc-if rassoc-if-not subst subst-if @@ -776,7 +776,6 @@ (when (and testp notp) (error ":TEST and :TEST-NOT were both supplied.")) (let ((key (and key (%coerce-callable-to-fun key)))) - (declare (inline member)) (if (let ((key-val (apply-key key item))) (if notp (member key-val list :test-not test-not :key key) @@ -784,6 +783,14 @@ list (cons item list)))) +(define-compiler-macro adjoin (item list &rest keys) + (with-unique-names (n-item n-list) + `(let ((,n-item ,item) + (,n-list ,list)) + (if (member ,n-item ,n-list ,@keys) + ,n-list + (cons ,n-item ,n-list))))) + (defconstant +list-based-union-limit+ 80) (defun union (list1 list2 &key key (test #'eql testp) (test-not nil notp)) diff --git a/version.lisp-expr b/version.lisp-expr index bfc9de798..70ae36374 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".) -"1.0.16.4" +"1.0.16.5" -- 2.11.4.GIT