From: Christophe Rhodes Date: Wed, 12 May 2004 15:49:01 +0000 (+0000) Subject: 0.8.10.21: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=ba2ae9bdedd98503dd3b73e64bf1408b645542b2;p=sbcl.git 0.8.10.21: Optimize CLRHASH a little (Juho Snellman sbcl-devel 2004-05-11) ... DECLARE (OPTIMIZE SPEED) probably makes a difference; ... rewriting DOs as FILL probably doesn't really, but looks better; ... might as well put the AVER before rather than after the FILL. --- diff --git a/src/code/target-hash-table.lisp b/src/code/target-hash-table.lisp index c28e640..38bae0c 100644 --- a/src/code/target-hash-table.lisp +++ b/src/code/target-hash-table.lisp @@ -597,21 +597,18 @@ #!+sb-doc "This removes all the entries from HASH-TABLE and returns the hash table itself." + (declare (optimize speed)) (let* ((kv-vector (hash-table-table hash-table)) - (kv-length (length kv-vector)) (next-vector (hash-table-next-vector hash-table)) (hash-vector (hash-table-hash-vector hash-table)) (size (length next-vector)) - (index-vector (hash-table-index-vector hash-table)) - (length (length index-vector))) + (index-vector (hash-table-index-vector hash-table))) ;; Disable GC tricks. (set-header-data kv-vector sb!vm:vector-normal-subtype) ;; Mark all slots as empty by setting all keys and values to magic ;; tag. - (do ((i 2 (1+ i))) - ((>= i kv-length)) - (setf (aref kv-vector i) +empty-ht-slot+)) (aver (eq (aref kv-vector 0) hash-table)) + (fill kv-vector +empty-ht-slot+ :start 2) ;; Set up the free list, all free. (do ((i 1 (1+ i))) ((>= i (1- size))) @@ -620,12 +617,10 @@ (setf (hash-table-next-free-kv hash-table) 1) (setf (hash-table-needing-rehash hash-table) 0) ;; Clear the index-vector. - (dotimes (i length) - (setf (aref index-vector i) 0)) + (fill index-vector 0) ;; Clear the hash-vector. (when hash-vector - (dotimes (i size) - (setf (aref hash-vector i) +magic-hash-vector-value+)))) + (fill hash-vector +magic-hash-vector-value+))) (setf (hash-table-number-entries hash-table) 0) hash-table) diff --git a/version.lisp-expr b/version.lisp-expr index 9d607a1..ba36119 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.8.10.20" +"0.8.10.21"