[elephant-cvs] CVS update: elephant/src/collections.lisp

blee at common-lisp.net blee at common-lisp.net
Sat Aug 28 06:39:31 UTC 2004


Update of /project/elephant/cvsroot/elephant/src
In directory common-lisp.net:/tmp/cvs-serv22059/src

Modified Files:
	collections.lisp 
Log Message:
performance tweaking

Date: Sat Aug 28 08:39:31 2004
Author: blee

Index: elephant/src/collections.lisp
diff -u elephant/src/collections.lisp:1.3 elephant/src/collections.lisp:1.4
--- elephant/src/collections.lisp:1.3	Fri Aug 27 19:32:32 2004
+++ elephant/src/collections.lisp	Sat Aug 28 08:39:30 2004
@@ -43,47 +43,37 @@
 ;;; equal hashing (except probably for array, hashe, instance keys!)
 (defclass persistent-collection (persistent) ())
 
-(defgeneric get-value (key ht &rest args))
-(defgeneric remove-kv (key ht &rest args))
+;(defgeneric get-value (key ht &rest args))
+;(defgeneric remove-kv (key ht &rest args))
 
 ;;; btree access
 (defclass btree (persistent-collection) ())
 
-(defmethod get-value (key (ht btree) &rest args)
-  (declare (ignore args))
+(defmethod get-value (key (ht btree))
+  (declare (optimize (speed 3) (safety 0) (space 3)))
   (buffer-write-int (oid ht) *key-buf*)
   (let ((key-length (serialize key *key-buf*)))
-    (handler-case 
-	(values
-	 (deserialize (db-get-key-buffered 
-		       (controller-db *store-controller*) 
-		       (buffer-stream-buffer *key-buf*)
-		       key-length))
-	 t)
-      (db-error (err)
-	(if (= (db-error-errno err) DB_NOTFOUND)
-	    (values nil nil)
-	    (error err))))))
+    (declare (type fixnum key-length))
+    (deserialize (db-get-key-buffered 
+		  (controller-db *store-controller*) 
+		  (buffer-stream-buffer *key-buf*)
+		  key-length))))
 
-(defmethod (setf get-value) (value key (ht btree) &rest args
-			     &key (transaction *current-transaction*)
-			     (auto-commit *auto-commit*)
-			     &allow-other-keys)
-  (declare (ignore args))
+(defmethod (setf get-value) (value key (ht btree))
+  (declare (optimize (speed 3) (safety 0)))
   (buffer-write-int (oid ht) *key-buf*)
   (let ((key-length (serialize key *key-buf*))
 	(val-length (serialize value *out-buf*)))
     (db-put-buffered (controller-db *store-controller*) 
 		     (buffer-stream-buffer *key-buf*) key-length
 		     (buffer-stream-buffer *out-buf*) val-length
-		     :transaction transaction
-		     :auto-commit auto-commit)))
+		     :transaction *current-transaction*
+		     :auto-commit *auto-commit*)))
 
-(defmethod remove-kv (key (ht btree) &rest args
+(defmethod remove-kv (key (ht btree)
 		      &key (transaction *current-transaction*) 
-		      (auto-commit *auto-commit*)
-		      &allow-other-keys)
-  (declare (ignore args))
+		      (auto-commit *auto-commit*))
+  (declare (optimize (speed 3) (safety 0)))
   (buffer-write-int (oid ht) *key-buf*)
   (let ((key-length (serialize key *key-buf*)))
     (db-delete-buffered (controller-db *store-controller*) 





More information about the Elephant-cvs mailing list