[elephant-devel] Serialization

Pierre THIERRY nowhere.man at levallois.eu.org
Wed Nov 22 01:34:35 UTC 2006


Scribit Ian Eslick dies 21/11/2006 hora 19:18:
> I have no objections to the  proposal you sent out earlier (i.e.,
> extra *feature* and reader  conditionals on optimizations)

I made the optimize form conditional everywhere it appears, here is the
patch for HEAD.

Quickly,
Pierre
-- 
nowhere.man at levallois.eu.org
OpenPGP 0xD9D50D8A
-------------- next part --------------
Index: src/db-acache/acache-controller.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/db-acache/acache-controller.lisp,v
retrieving revision 1.2
diff -u -r1.2 acache-controller.lisp
--- src/db-acache/acache-controller.lisp	21 Feb 2006 19:40:02 -0000	1.2
+++ src/db-acache/acache-controller.lisp	22 Nov 2006 01:36:04 -0000
@@ -74,23 +74,23 @@
   `(rplacd (rplaca *index-cons* ,oid) ,name))
 
 (defmethod persistent-slot-reader ((sc acache-store-controller) instance name)
-  (declare (optimize (speed 3) (safety 1)))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 1)))
   (multiple-value-bind (val valid?) (map-value (controller-slots sc) (fast-key (oid instance) name))
     (if valid?
 	val
 	(error "Slot ~A unbound in ~A" name instance))))
 
 (defmethod persistent-slot-writer ((sc acache-store-controller) value instance name)
-  (declare (optimize (speed 3) (safety 1)))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 1)))
   (setf (map-value (controller-slots sc) (fast-key (oid instance) name))
 	value))
 
 (defmethod persistent-slot-boundp ((sc acache-store-controller) instance name)
-  (declare (optimize (speed 3) (safety 1)))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 1)))
   (when (map-value (controller-slots sc) (fast-key (oid instance) name))
     t))
 
 (defmethod persistent-slot-makunbound ((sc acache-store-controller) instance name)
-  (declare (optimize (speed 3) (safety 1)))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 1)))
   (remove-from-map (controller-slots sc) (fast-key (oid instance) name)))
 
Index: src/db-bdb/bdb-collections.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/db-bdb/bdb-collections.lisp,v
retrieving revision 1.10
diff -u -r1.10 bdb-collections.lisp
--- src/db-bdb/bdb-collections.lisp	11 Nov 2006 18:41:10 -0000	1.10
+++ src/db-bdb/bdb-collections.lisp	22 Nov 2006 01:36:04 -0000
@@ -32,7 +32,7 @@
   (make-instance 'bdb-btree :sc sc))
 
 (defmethod get-value (key (bt bdb-btree))
-  (declare (optimize (speed 3) (space 0) (safety 0)))
+  (declare #-elephant-without-optimize(optimize (speed 3) (space 0) (safety 0)))
   (let ((sc (get-con bt)))
     (with-buffer-streams (key-buf value-buf)
       (buffer-write-int (oid bt) key-buf)
@@ -43,7 +43,7 @@
 	    (values nil nil))))))
 
 (defmethod existsp (key (bt bdb-btree))
-  (declare (optimize (speed 3) (safety 0) (space 0)))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0) (space 0)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (oid bt) key-buf)
     (serialize key key-buf)
@@ -55,7 +55,7 @@
 
 
 (defmethod (setf get-value) (value key (bt bdb-btree))
-  (declare (optimize (speed 3) (safety 0) (space 0)))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0) (space 0)))
   (assert (or *auto-commit* (not (eq *current-transaction* 0))))
 ;;  (with-transaction (:store-controller (get-con bt))
     (with-buffer-streams (key-buf value-buf)
@@ -68,7 +68,7 @@
       value))
 
 (defmethod remove-kv (key (bt bdb-btree))
-  (declare (optimize (speed 3) (space 0) (safety 0)))
+  (declare #-elephant-without-optimize(optimize (speed 3) (space 0) (safety 0)))
   (assert (or *auto-commit* (not (eq *current-transaction* 0))))
 ;;  (with-transaction (:store-controller (get-con bt))
     (with-buffer-streams (key-buf)
@@ -198,7 +198,7 @@
 
 (defmethod remove-kv (key (bt bdb-indexed-btree))
   "Remove a key / value pair, and update secondary indices."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (let ((sc (get-con bt)))
       (with-buffer-streams (key-buf secondary-buf)
 	(buffer-write-int (oid bt) key-buf)
@@ -234,7 +234,7 @@
 
 (defmethod get-value (key (bt bdb-btree-index))
   "Get the value in the primary DB from a secondary key."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (oid bt) key-buf)
     (serialize key key-buf)
@@ -245,7 +245,7 @@
 	  (values nil nil)))))
 
 (defmethod get-primary-key (key (bt btree-index))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (oid bt) key-buf)
     (serialize key key-buf)
@@ -263,19 +263,19 @@
 
 (defmethod make-cursor ((bt bdb-btree))
   "Make a cursor from a btree."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (make-instance 'bdb-cursor 
 		 :btree bt
 		 :handle (db-cursor (controller-btrees (get-con bt)))
 		 :oid (oid bt)))
 
 (defmethod cursor-close ((cursor bdb-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (db-cursor-close (cursor-handle cursor))
   (setf (cursor-initialized-p cursor) nil))
 
 (defmethod cursor-duplicate ((cursor bdb-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (make-instance (type-of cursor)
 		 :initialized-p (cursor-initialized-p cursor)
 		 :oid (cursor-oid cursor)
@@ -284,7 +284,7 @@
 			  :position (cursor-initialized-p cursor))))
 
 (defmethod cursor-current ((cursor bdb-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (when (cursor-initialized-p cursor)
     (with-buffer-streams (key-buf value-buf)
       (multiple-value-bind (key val)
@@ -299,7 +299,7 @@
 	    (setf (cursor-initialized-p cursor) nil))))))
 
 (defmethod cursor-first ((cursor bdb-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
     (multiple-value-bind (key val)
@@ -315,7 +315,7 @@
 		 
 ;;A bit of a hack.....
 (defmethod cursor-last ((cursor bdb-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (+ (cursor-oid cursor) 1) key-buf)
     (if (db-cursor-set-buffered (cursor-handle cursor) 
@@ -346,7 +346,7 @@
 	      (setf (cursor-initialized-p cursor) nil))))))
 
 (defmethod cursor-next ((cursor bdb-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf value-buf)
 	(multiple-value-bind (key val)
@@ -359,7 +359,7 @@
       (cursor-first cursor)))
 	  
 (defmethod cursor-prev ((cursor bdb-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf value-buf)
 	(multiple-value-bind (key val)
@@ -372,7 +372,7 @@
       (cursor-last cursor)))
 	  
 (defmethod cursor-set ((cursor bdb-cursor) key)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
     (serialize key key-buf)
@@ -385,7 +385,7 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-set-range ((cursor bdb-cursor) key)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
     (serialize key key-buf)
@@ -399,7 +399,7 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-get-both ((cursor bdb-cursor) key value)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
     (serialize key key-buf)
@@ -414,7 +414,7 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-get-both-range ((cursor bdb-cursor) key value)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
     (serialize key key-buf)
@@ -428,7 +428,7 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-delete ((cursor bdb-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf value-buf)
 	(multiple-value-bind (key val)
@@ -447,7 +447,7 @@
   "Put by cursor.  Not particularly useful since primaries
 don't support duplicates.  Currently doesn't properly move
 the cursor."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if key-specified-p
       (setf (get-value key (cursor-btree cursor)) value)
       (if (cursor-initialized-p cursor)
@@ -471,7 +471,7 @@
 
 (defmethod make-cursor ((bt bdb-btree-index))
   "Make a secondary-cursor from a secondary index."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (make-instance 'bdb-secondary-cursor 
 		 :btree bt
 		 :handle (db-cursor 
@@ -480,7 +480,7 @@
 
 
 (defmethod cursor-pcurrent ((cursor bdb-secondary-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (when (cursor-initialized-p cursor)
     (with-buffer-streams (key-buf pkey-buf value-buf)
       (multiple-value-bind (key pkey val)
@@ -500,7 +500,7 @@
 	    (setf (cursor-initialized-p cursor) nil))))))
 
 (defmethod cursor-pfirst ((cursor bdb-secondary-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
     (multiple-value-bind (key pkey val)
@@ -516,7 +516,7 @@
 		 
 ;;A bit of a hack.....
 (defmethod cursor-plast ((cursor bdb-secondary-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (buffer-write-int (+ (cursor-oid cursor) 1) key-buf)
     (if (db-cursor-set-buffered (cursor-handle cursor) 
@@ -547,7 +547,7 @@
 	      (setf (cursor-initialized-p cursor) nil))))))
 
 (defmethod cursor-pnext ((cursor bdb-secondary-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf pkey-buf value-buf)
 	(multiple-value-bind (key pkey val)
@@ -563,7 +563,7 @@
       (cursor-pfirst cursor)))
 	  
 (defmethod cursor-pprev ((cursor bdb-secondary-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf pkey-buf value-buf)
 	(multiple-value-bind (key pkey val)
@@ -579,7 +579,7 @@
       (cursor-plast cursor)))
 	  
 (defmethod cursor-pset ((cursor bdb-secondary-cursor) key)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
     (serialize key key-buf)
@@ -593,7 +593,7 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-pset-range ((cursor bdb-secondary-cursor) key)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
     (serialize key key-buf)
@@ -608,7 +608,7 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-pget-both ((cursor bdb-secondary-cursor) key pkey)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (let ((primary-oid (oid (primary (cursor-btree cursor)))))
       (buffer-write-int (cursor-oid cursor) key-buf)
@@ -625,7 +625,7 @@
 	    (setf (cursor-initialized-p cursor) nil))))))
 
 (defmethod cursor-pget-both-range ((cursor bdb-secondary-cursor) key pkey)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (let ((primary-oid (oid (primary (cursor-btree cursor)))))    
       (buffer-write-int (cursor-oid cursor) key-buf)
@@ -643,7 +643,7 @@
 
 (defmethod cursor-delete ((cursor bdb-secondary-cursor))
   "Delete by cursor: deletes ALL secondary indices."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf pkey-buf value-buf)
 	(multiple-value-bind (key pkey val)
@@ -681,7 +681,7 @@
   (error "Puts are forbidden on secondary indices.  Try adding to the primary."))
 
 (defmethod cursor-next-dup ((cursor bdb-secondary-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (when (cursor-initialized-p cursor)
     (with-buffer-streams (key-buf value-buf)
       (multiple-value-bind (key val)
@@ -693,7 +693,7 @@
 	    (setf (cursor-initialized-p cursor) nil))))))
 	  
 (defmethod cursor-next-nodup ((cursor bdb-secondary-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf value-buf)
 	(multiple-value-bind (key val)
@@ -706,7 +706,7 @@
       (cursor-first cursor)))	  
 
 (defmethod cursor-prev-nodup ((cursor bdb-secondary-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf value-buf)
 	(multiple-value-bind (key val)
@@ -719,7 +719,7 @@
       (cursor-last cursor)))
 
 (defmethod cursor-pnext-dup ((cursor bdb-secondary-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (when (cursor-initialized-p cursor)
     (with-buffer-streams (key-buf pkey-buf value-buf)
       (multiple-value-bind (key pkey val)
@@ -732,7 +732,7 @@
 	    (setf (cursor-initialized-p cursor) nil))))))
 	  
 (defmethod cursor-pnext-nodup ((cursor bdb-secondary-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf pkey-buf value-buf)
 	(multiple-value-bind (key pkey val)
@@ -746,7 +746,7 @@
       (cursor-pfirst cursor)))
 
 (defmethod cursor-pprev-nodup ((cursor bdb-secondary-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf pkey-buf value-buf)
 	(multiple-value-bind (key pkey val)
Index: src/db-bdb/bdb-controller.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/db-bdb/bdb-controller.lisp,v
retrieving revision 1.13
diff -u -r1.13 bdb-controller.lisp
--- src/db-bdb/bdb-controller.lisp	11 Nov 2006 18:41:10 -0000	1.13
+++ src/db-bdb/bdb-controller.lisp	22 Nov 2006 01:36:04 -0000
@@ -232,7 +232,7 @@
 ;;
 
 (defmethod persistent-slot-reader ((sc bdb-store-controller) instance name)
-;;  (declare (optimize (speed 3) (safety 1) (space 1)))
+;;  (declare #-elephant-without-optimize(optimize (speed 3) (safety 1) (space 1)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (oid instance) key-buf)
     (serialize name key-buf)
@@ -245,7 +245,7 @@
 	  (error 'unbound-slot :instance instance :name name)))))
 
 (defmethod persistent-slot-writer ((sc bdb-store-controller) new-value instance name)
-;;  (declare (optimize (speed 3) (safety 1) (space 1)))
+;;  (declare #-elephant-without-optimize(optimize (speed 3) (safety 1) (space 1)))
 ;;  (format t "psw -- sc: ~A  ct: ~A ac: ~A~%" *store-controller* *current-transaction* *auto-commit*)
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (oid instance) key-buf)
@@ -258,7 +258,7 @@
     new-value))
 
 (defmethod persistent-slot-boundp ((sc bdb-store-controller) instance name)
-;;  (declare (optimize (speed 3) (safety 1) (space 1)))
+;;  (declare #-elephant-without-optimize(optimize (speed 3) (safety 1) (space 1)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (oid instance) key-buf)
     (serialize name key-buf)
@@ -267,7 +267,7 @@
       (if buf t nil))))
 
 (defmethod persistent-slot-makunbound ((sc bdb-store-controller) instance name)
-;;  (declare (optimize (speed 3) (safety 1) (space 1)))
+;;  (declare #-elephant-without-optimize(optimize (speed 3) (safety 1) (space 1)))
   (with-buffer-streams (key-buf)
     (buffer-write-int (oid instance) key-buf)
     (serialize name key-buf)
Index: src/db-bdb/berkeley-db.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/db-bdb/berkeley-db.lisp,v
retrieving revision 1.1
diff -u -r1.1 berkeley-db.lisp
--- src/db-bdb/berkeley-db.lisp	11 Nov 2006 18:43:31 -0000	1.1
+++ src/db-bdb/berkeley-db.lisp	22 Nov 2006 01:36:04 -0000
@@ -607,7 +607,7 @@
 a buffer-stream.  Space for the value is passed in as a
 buffer-stream.  On success the buffer-stream is returned for
 decoding, or NIL if nothing was found."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void db transaction)
 	   (type buffer-stream key-buffer-stream value-buffer-stream)
 	   (type boolean auto-commit get-both degree-2 read-committed dirty-read read-uncommitted))
@@ -658,7 +658,7 @@
 string.  Space for the value is passed in as a
 buffer-stream.  On success the buffer-stream is returned for
 decoding, or NIL if nothing was found."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void db transaction)
 	   (type string key)
 	   (type buffer-stream value-buffer-stream)
@@ -698,7 +698,7 @@
   "Get a key / value pair from a DB.  The key is passed as a
 string, and the value is returned as a string.  If nothing
 is found, NIL is returned."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void db transaction)
 	   (type string key)
 	   (type fixnum key-size)
@@ -749,7 +749,7 @@
   "Put a key / value pair into a DB.  The pair are encoded
 in buffer-streams.  T on success, or nil if the key already
 exists and EXISTS-ERROR-P is NIL."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void db transaction)
 	   (type buffer-stream key-buffer-stream value-buffer-stream)
 	   (type boolean auto-commit exists-error-p))
@@ -784,7 +784,7 @@
 		   (value-size (length value))
 		   (transaction *current-transaction*))
 	    :cstrings (key value)
-	    :declarations (declare (optimize (speed 3) (safety 0))
+	    :declarations (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 				   (type pointer-void db transaction)
 				   (type string key value)
 				   (type fixnum key-size value-size)
@@ -806,7 +806,7 @@
   "Delete a key / value pair from a DB.  The key is encoded
 in a buffer-stream.  T on success, NIL if the key wasn't
 found."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void db transaction) 
 	   (type buffer-stream key-buffer-stream)
 	   (type boolean auto-commit))
@@ -836,7 +836,7 @@
 		  (transaction *current-transaction*))
   "Delete a key / value pair from a DB.  The key is a
 string.  T on success, NIL if the key wasn't found."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void db transaction) (type string key)
 	   (type fixnum key-size) (type boolean auto-commit))
   (with-cstrings ((key key))
@@ -868,7 +868,7 @@
 duplicates.  The key and value are encoded as
 buffer-streams.  T on success, NIL if the key / value pair
 wasn't found."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void db transaction) 
 	   (type buffer-stream key-buffer-stream value-buffer-stream))
   (let ((errno (%db-delete-kv db transaction
@@ -903,7 +903,7 @@
 
 (defun db-compact (db start stop end &key (transaction *current-transaction*)
 		   freelist-only free-space)
-  (declare (optimize (speed 3) (safety 2))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 2))
 	   (type pointer-void db transaction)
 	   (type buffer-stream start stop)
 	   (type boolean freelist-only free-space))
@@ -943,7 +943,7 @@
 (defun db-cursor (db &key (transaction *current-transaction*)
 		  degree-2 read-committed dirty-read read-uncommitted)
   "Create a cursor."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void db)
 	   (type boolean degree-2 read-committed dirty-read read-uncommitted)
 	   (type pointer-int *errno-buffer*))
@@ -969,7 +969,7 @@
 
 (defun db-cursor-delete (cursor)
   "Delete by cursor."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void cursor))
   (let ((errno (%db-cursor-delete cursor 0)))
     (declare (type fixnum errno))
@@ -990,7 +990,7 @@
 
 (defun db-cursor-duplicate (cursor &key (position t)) 
   "Duplicate a cursor."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void cursor))
   (let* ((newc (%db-cursor-dup cursor (flags :position position) 
 			       *errno-buffer*))
@@ -1021,7 +1021,7 @@
   "Move a cursor, returning the key / value pair found.
 Supports current, first, last, next, next-dup, next-nodup,
 prev, prev-nodup."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void cursor)
 	   (type buffer-stream key-buffer-stream value-buffer-stream)
 	   (type boolean current first last next next-dup next-nodup prev 
@@ -1067,7 +1067,7 @@
 			       &key set set-range dirty-read read-uncommitted)
   "Move a cursor to a key, returning the key / value pair
 found.  Supports set and set-range."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void cursor)
 	   (type buffer-stream key-buffer-stream value-buffer-stream)
 	   (type boolean set set-range dirty-read read-uncommitted))
@@ -1108,7 +1108,7 @@
 				    &key get-both get-both-range dirty-read read-uncommitted)
   "Move a cursor to a key / value pair, returning the key /
 value pair found.  Supports get-both and get-both-range."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void cursor)
 	   (type buffer-stream key-buffer-stream value-buffer-stream)
 	   (type boolean get-both get-both-range dirty-read read-uncommitted))
@@ -1170,7 +1170,7 @@
   "Move a secondary cursor, returning the key / value /
 primary triple found.  Supports current, first, last, next,
 next-dup, next-nodup, prev, prev-nodup."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void cursor)
 	   (type buffer-stream key-buffer-stream pkey-buffer-stream 
 		 value-buffer-stream)
@@ -1226,7 +1226,7 @@
 				&key set set-range dirty-read)
   "Move a secondary cursor tp a key, returning the key / value /
 primary triple found.  Supports set, set-range."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void cursor)
 	   (type buffer-stream key-buffer-stream pkey-buffer-stream 
 		 value-buffer-stream)
@@ -1278,7 +1278,7 @@
   "Move a secondary cursor tp a key / primary pair,
 returning the key / value / primary triple found.  Supports
 get, get-range."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void cursor)
 	   (type buffer-stream key-buffer-stream pkey-buffer-stream 
 		 value-buffer-stream)
@@ -1336,7 +1336,7 @@
 			       &key after before current keyfirst keylast
 			       no-dup-data exists-error-p)
   "Put by cursor.  The key and value are encoded as buffer-streams."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void cursor)
 	   (type buffer-stream key-buffer-stream value-buffer-stream)
 	   (type boolean after before current keyfirst keylast no-dup-data
@@ -1375,7 +1375,7 @@
 			     degree-2 read-committed dirty-read read-uncommitted
 			     txn-nosync txn-nowait txn-sync)
   "Start a transaction.  Transactions may be nested."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void env parent)
 	   (type boolean degree-2 read-committed dirty-read read-uncommitted 
 		 txn-nosync txn-nowait txn-sync)
@@ -1401,7 +1401,7 @@
 
 (wrap-errno (db-transaction-abort %db-txn-abort) (transaction)
 	    :keys ((transaction *current-transaction*))
-	    :declarations (declare (optimize (speed 3) (safety 0))
+	    :declarations (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 				   (type pointer-void transaction))
 	    :documentation "Abort a transaction.")
 
@@ -1413,7 +1413,7 @@
 (wrap-errno (db-transaction-commit %db-txn-commit) (transaction flags)
 	    :keys ((transaction *current-transaction*))
 	    :flags (txn-nosync txn-sync)
-	    :declarations (declare (optimize (speed 3) (safety 0))
+	    :declarations (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 				   (type pointer-void transaction)
 				   (type boolean txn-nosync txn-sync))
 	    :documentation "Commit a transaction.")
@@ -1513,7 +1513,7 @@
 
 (defun db-transaction-id (&optional (transaction *current-transaction*))
   "Returns the ID of the transaction (for locking purposes.)"
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (%db-transaction-id transaction))
 
 (def-function ("db_env_lock_id" %db-env-lock-id)
@@ -1703,7 +1703,7 @@
 
 (defun db-sequence-create (db)
   "Create a new sequence."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void db)
 	   (type pointer-int *errno-buffer*))
   (let* ((seq
@@ -1751,7 +1751,7 @@
 (defun db-sequence-get (sequence delta &key auto-commit txn-nosync 
 			(transaction *current-transaction*))
   "Get the next element."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void sequence transaction)
 	   (type fixnum delta)
 	   (type boolean auto-commit txn-nosync))
@@ -1780,7 +1780,7 @@
 (defun db-sequence-get-fixnum (sequence delta &key auto-commit txn-nosync 
 			       (transaction *current-transaction*))
   "Get the next element as a fixnum."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type pointer-void sequence transaction)
 	   (type fixnum delta)
 	   (type boolean auto-commit txn-nosync))
Index: src/db-clsql/sql-collections.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/db-clsql/sql-collections.lisp,v
retrieving revision 1.6
diff -u -r1.6 sql-collections.lisp
--- src/db-clsql/sql-collections.lisp	11 Nov 2006 18:41:11 -0000	1.6
+++ src/db-clsql/sql-collections.lisp	22 Nov 2006 01:36:04 -0000
@@ -21,7 +21,7 @@
 
 (defmethod get-value (key (bt sql-btree-index))
   "Get the value in the primary DB from a secondary key."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
       ;; Below, the take the oid and add it to the key, then look
       ;; thing up--- where?
 
@@ -35,7 +35,7 @@
 	)))
 
 (defmethod get-primary-key (key (bt sql-btree-index))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
       (let* ((sc (get-con bt))
 	     (con (controller-db sc))
 	     )
@@ -53,7 +53,7 @@
 
 (defmethod make-cursor ((bt sql-btree))
   "Make a cursor from a btree."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (make-instance 'sql-cursor 
 		 :btree bt
 		 :oid (oid bt)))
@@ -68,7 +68,7 @@
 ;; I'm not sure what cursor-duplicate is meant to do, and if 
 ;; the other state needs to be copied or now.  Probably soo...
 (defmethod cursor-duplicate ((cursor sql-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (make-instance (type-of cursor)
 		 :initialized-p (cursor-initialized-p cursor)
 		 :oid (cursor-oid cursor)
@@ -80,7 +80,7 @@
 ;;			  :position (cursor-initialized-p cursor))))
 
 (defmethod cursor-current ((cursor sql-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (when (cursor-initialized-p cursor)
     (has-key-value cursor)))
 
@@ -168,7 +168,7 @@
  
 
 (defmethod cursor-first ((cursor sql-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   ;; Read all of the keys...
   ;; We need to get the contoller db from the btree somehow...
   (cursor-init cursor)
@@ -197,7 +197,7 @@
       (cursor-first cursor)))
 	  
 (defmethod cursor-prev ((cursor sql-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (progn
 	(decf (:sql-crsr-ck cursor))
@@ -205,7 +205,7 @@
       (cursor-last cursor)))
 	  
 (defmethod cursor-set ((cursor sql-cursor) key)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if  (cursor-initialized-p cursor)
        (let ((p (position key (:sql-crsr-ks cursor) :test #'equal)))
 	 (if p
@@ -228,7 +228,7 @@
   
 
 (defmethod cursor-set-range ((cursor sql-cursor) key)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   ;; I'm a little fuzzy on when I should leave a cursor in
   ;; the initialized state...
   (unless (cursor-initialized-p cursor)
@@ -254,7 +254,7 @@
 
 
 (defmethod cursor-get-both ((cursor sql-cursor) key value)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (let* ((bt (cursor-btree cursor))
 	 (v (get-value key bt)))
     (if (equal v value)
@@ -265,7 +265,7 @@
 
 ;; This needs to be rewritten!
 (defmethod cursor-get-both-range ((cursor sql-cursor) key value)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (let* ((bt (cursor-btree cursor))
 	 (v (get-value key bt)))
     ;; Since we don't allow duplicates in primary cursors, I 
@@ -278,7 +278,7 @@
 
 
 (defmethod cursor-delete ((cursor sql-cursor))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (multiple-value-bind 
        (has k v) 
@@ -294,7 +294,7 @@
   "Put by cursor.  Not particularly useful since primaries
 don't support duplicates.  Currently doesn't properly move
 the cursor."
-  (declare (optimize (speed 3))
+  (declare #-elephant-without-optimize(optimize (speed 3))
 	   (ignore key value key-specified-p))
   (error "Puts on sql-cursors are not yet implemented, because I can't get them to work on BDB cursors!"))
 
@@ -308,7 +308,7 @@
 
 (defmethod make-cursor ((bt sql-btree-index))
   "Make a secondary-cursor from a secondary index."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (make-instance 'sql-secondary-cursor 
 		 :btree bt
 		 :oid (oid bt)))
@@ -359,7 +359,7 @@
   (cursor-prev-x cursor :returnpk t))
 	  
 (defmethod cursor-pset ((cursor sql-secondary-cursor) key)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (unless (cursor-initialized-p cursor)
     (cursor-init cursor))
   (let ((idx (position key (:sql-crsr-ks cursor))))
@@ -381,7 +381,7 @@
 )
 
 (defmethod cursor-pset-range ((cursor sql-secondary-cursor) key)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (unless (cursor-initialized-p cursor)
     (cursor-init cursor))
   (let ((idx (array-index-if #'(lambda (x) (my-generic-at-most key x)) (:sql-crsr-ks cursor))))
@@ -399,7 +399,7 @@
 ;; with secondary key equal to the key argument, and primary key greater or equal to the pkey argument.
 ;; Returns has-tuple / secondary key / value / primary key.
 (defmethod cursor-pget-both ((cursor sql-secondary-cursor) key pkey)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
 ;; It's better to get the value by the primary key, 
 ;; as that is unique..
   (let* ((bt (primary (cursor-btree cursor)))
@@ -424,7 +424,7 @@
 	(cursor-un-init cursor :returnpk t))))
 
 (defmethod cursor-pget-both-range ((cursor sql-secondary-cursor) key pkey)
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   ;; It's better to get the value by the primary key, 
   ;; as that is unique..
   (do ((vs 
@@ -452,7 +452,7 @@
 
 (defmethod cursor-delete ((cursor sql-secondary-cursor))
   "Delete by cursor: deletes ALL secondary indices."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (multiple-value-bind 
 	    (m k v p) 
@@ -498,7 +498,7 @@
   )
 
 (defmethod cursor-first-x ((cursor sql-secondary-cursor) &key (returnpk nil))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (setf (:dp-nmbr cursor) 0)
   (cursor-init cursor)
   (has-key-value-scnd cursor :returnpk returnpk)
@@ -523,7 +523,7 @@
   (cursor-prev-x cursor)
 )
 (defmethod cursor-prev-x ((cursor sql-secondary-cursor)  &key (returnpk nil))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (progn
 	(let ((cur-pk (get-current-key cursor)))
@@ -548,7 +548,7 @@
 )
 
 (defmethod cursor-next-dup-x ((cursor sql-secondary-cursor) &key (returnpk nil))
-;;  (declare (optimize (speed 3)))
+;;  (declare #-elephant-without-optimize(optimize (speed 3)))
   (when (cursor-initialized-p cursor)
     (let* ((cur-pk (aref (:sql-crsr-ks cursor)
 			 (:sql-crsr-ck cursor)))
@@ -614,7 +614,7 @@
   (cursor-prev-nodup-x cursor)
 )
 (defmethod cursor-prev-nodup-x ((cursor sql-secondary-cursor) &key (returnpk nil))
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (progn
 	(setf (:sql-crsr-ck cursor) (- (:sql-crsr-ck cursor) (+ 1 (:dp-nmbr cursor))))
Index: src/db-clsql/sql-controller.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/db-clsql/sql-controller.lisp,v
retrieving revision 1.12
diff -u -r1.12 sql-controller.lisp
--- src/db-clsql/sql-controller.lisp	11 Nov 2006 18:41:11 -0000	1.12
+++ src/db-clsql/sql-controller.lisp	22 Nov 2006 01:36:04 -0000
@@ -188,7 +188,7 @@
 
 (defmethod remove-kv (key (bt sql-indexed-btree))
   "Remove a key / value pair, and update secondary indices."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (let* (
 	 (sc (get-con bt))
 	 (con (controller-db sc)))
Index: src/elephant/classes.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/elephant/classes.lisp,v
retrieving revision 1.9
diff -u -r1.9 classes.lisp
--- src/elephant/classes.lisp	26 Apr 2006 17:53:44 -0000	1.9
+++ src/elephant/classes.lisp	22 Nov 2006 01:36:04 -0000
@@ -235,13 +235,13 @@
 
 (defmethod slot-value-using-class :around ((class persistent-metaclass) (instance persistent-object) (slot-def persistent-slot-definition))
   "Get the slot value from the database."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (let ((name (slot-definition-name slot-def)))
     (persistent-slot-reader (get-con instance) instance name)))
 
 (defmethod (setf slot-value-using-class) :around (new-value (class persistent-metaclass) (instance persistent-object) (slot-def persistent-slot-definition))
   "Set the slot value in the database."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (indexed class)
       (indexed-slot-writer class instance slot-def new-value)
       (let ((name (slot-definition-name slot-def)))
@@ -249,13 +249,13 @@
 
 (defmethod slot-boundp-using-class :around ((class persistent-metaclass) (instance persistent-object) (slot-def persistent-slot-definition))
   "Checks if the slot exists in the database."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (let ((name (slot-definition-name slot-def)))
     (persistent-slot-boundp (get-con instance) instance name)))
 
 (defmethod slot-boundp-using-class :around ((class persistent-metaclass) (instance persistent-object) (slot-name symbol))
   "Checks if the slot exists in the database."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (loop for slot in (class-slots class)
 	for matches-p = (eq (slot-definition-name slot) slot-name)
 	until matches-p
@@ -266,7 +266,7 @@
 
 (defmethod slot-makunbound-using-class :around ((class persistent-metaclass) (instance persistent-object) (slot-def persistent-slot-definition))
   "Deletes the slot from the database."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   ;; NOTE: call remove-indexed-slot here instead?
   (when (indexed slot-def)
     (unregister-indexed-slot class (slot-definition-name slot-def)))
@@ -322,21 +322,21 @@
 #+(or cmu sbcl)
 (defun make-persistent-reader (name)
   (lambda (instance)
-    (declare (optimize (speed 3))
+    (declare #-elephant-without-optimize(optimize (speed 3))
 	     (type persistent-object instance))
     (persistent-slot-reader (get-con instance) instance name)))
 
 #+(or cmu sbcl)
 (defun make-persistent-writer (name)
   (lambda (new-value instance)
-    (declare (optimize (speed 3))
+    (declare #-elephant-without-optimize(optimize (speed 3))
 	     (type persistent-object instance))
     (persistent-slot-writer (get-con instance) new-value instance name)))
 
 #+(or cmu sbcl)
 (defun make-persistent-slot-boundp (name)
   (lambda (instance)
-    (declare (optimize (speed 3))
+    (declare #-elephant-without-optimize(optimize (speed 3))
 	     (type persistent-object instance))
     (persistent-slot-boundp (get-con instance) instance name)))
 
Index: src/elephant/classindex-utils.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/elephant/classindex-utils.lisp,v
retrieving revision 1.3
diff -u -r1.3 classindex-utils.lisp
--- src/elephant/classindex-utils.lisp	26 Apr 2006 17:53:44 -0000	1.3
+++ src/elephant/classindex-utils.lisp	22 Nov 2006 01:36:04 -0000
@@ -226,7 +226,7 @@
   (simple-match-set (synch-rule-lhs rule) features))
 
 (defun simple-match-set (a b)
-  (declare (optimize (speed 3) (safety 1)))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 1)))
   (cond ((null a) t)
 	((and (not (null a)) (null b)) nil)
 	((member (first a) b :test #'equal)
@@ -252,7 +252,7 @@
 	 (warn (warn "Performing slot synchronization actions: ~A" (synch-rule-rhs rule))))))
 
 (defun apply-synch-rules (class records rule-set)
-  (declare (optimize (speed 3) (safety 1)))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 1)))
   (labels ((slotname (rec) (car rec))
 	   (feature-set (rec) (cdr rec)))
     (loop for record in records do
Index: src/elephant/classindex.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/elephant/classindex.lisp,v
retrieving revision 1.14
diff -u -r1.14 classindex.lisp
--- src/elephant/classindex.lisp	21 Jul 2006 16:32:45 -0000	1.14
+++ src/elephant/classindex.lisp	22 Nov 2006 01:36:04 -0000
@@ -378,7 +378,7 @@
 
 (defmethod get-instances-by-value ((class persistent-metaclass) slot-name value)
 ;;  (declare 
-;;   (optimize (speed 3) (safety 1) (space 1))
+;;   #-elephant-without-optimize(optimize (speed 3) (safety 1) (space 1))
 ;;   (type (or string symbol) slot-name))
   (let ((instances nil))
     (with-btree-cursor (cur (find-inverted-index class slot-name))
@@ -407,7 +407,7 @@
   (get-instances-by-range (find-class class) slot-name start end))
 
 (defmethod get-instances-by-range ((class persistent-metaclass) idx-name start end)
-;;  (declare (optimize speed (safety 1) (space 1))
+;;  (declare #-elephant-without-optimize(optimize speed (safety 1) (space 1))
 ;;	   (type fixnum start end)
 ;;	   (type string idx-name))
   (with-inverted-cursor (cur class idx-name)
Index: src/elephant/collections.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/elephant/collections.lisp,v
retrieving revision 1.5
diff -u -r1.5 collections.lisp
--- src/elephant/collections.lisp	19 Jun 2006 01:03:30 -0000	1.5
+++ src/elephant/collections.lisp	22 Nov 2006 01:36:04 -0000
@@ -135,7 +135,7 @@
 (defmethod remove-kv (key (bt btree-index))
   "Remove a key / value from the PRIMARY by a secondary
 lookup, updating ALL other secondary indices."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (remove-kv (get-primary-key key bt) (primary bt)))
 
 
Index: src/elephant/serializer.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/elephant/serializer.lisp,v
retrieving revision 1.14
diff -u -r1.14 serializer.lisp
--- src/elephant/serializer.lisp	11 Nov 2006 22:53:13 -0000	1.14
+++ src/elephant/serializer.lisp	22 Nov 2006 01:36:05 -0000
@@ -132,13 +132,13 @@
 
 (defun serialize (frob bs)
   "Serialize a lisp value into a buffer-stream."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs))
   (let ((*lisp-obj-id* 0)
 	(*circularity-hash* (get-circularity-hash)))
     (labels 
 	((%serialize (frob)
-	 (declare (optimize (speed 3) (safety 0)))
+	 (declare #-elephant-without-optimize(optimize (speed 3) (safety 0)))
 	 (etypecase frob
 	   ((integer #.(- 1 (expt 2 31)) #.(1- (expt 2 31))) ;; fixnum
 	    (buffer-write-byte +fixnum+ bs)
@@ -328,7 +328,7 @@
     bs)))
 
 (defun slots-and-values (o)
-  (declare (optimize (speed 3) (safety 0)))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0)))
   (loop for sd in (compute-slots (class-of o))
 	for slot-name = (slot-definition-name sd)
 	with ret = ()
@@ -342,12 +342,12 @@
 
 (defun deserialize (buf-str &key sc)
   "Deserialize a lisp value from a buffer-stream."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type (or null buffer-stream) buf-str))
   (let ((*circularity-hash* (get-circularity-hash)))
     (labels 
       ((%deserialize (bs)
-	 (declare (optimize (speed 3) (safety 0))
+	 (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 		  (type buffer-stream bs))
 	 (let ((tag (buffer-read-byte bs)))
 	   (declare (type foreign-char tag))
@@ -496,7 +496,7 @@
        result))))))
 
 (defun deserialize-bignum (bs length positive)
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type fixnum length)
 	   (type boolean positive))
@@ -553,7 +553,7 @@
   (the (unsigned-byte 8) (gethash ty array-type-to-byte)))
 
 (defun int-byte-spec (position)
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type (unsigned-byte 24) position))
   #+(or cmu sbcl allegro)
   (progn (setf (cdr *resourced-byte-spec*) (* 32 position)) 
Index: src/memutil/memutil.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/src/memutil/memutil.lisp,v
retrieving revision 1.12
diff -u -r1.12 memutil.lisp
--- src/memutil/memutil.lisp	11 Nov 2006 22:53:13 -0000	1.12
+++ src/memutil/memutil.lisp	22 Nov 2006 01:36:05 -0000
@@ -125,14 +125,14 @@
 
 (defun grab-buffer-stream ()
   "Grab a buffer-stream from the *buffer-streams* resource pool."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (if (= (length *buffer-streams*) 0)
       (make-buffer-stream)
       (vector-pop *buffer-streams*)))
 
 (defun return-buffer-stream (bs)
   "Return a buffer-stream to the *buffer-streams* resource pool."
-  (declare (optimize (speed 3)))
+  (declare #-elephant-without-optimize(optimize (speed 3)))
   (reset-buffer-stream bs)
   (vector-push-extend bs *buffer-streams*))
 
@@ -159,7 +159,7 @@
 #+(or cmu sbcl)
 (defun read-int (buf offset)
   "Read a 32-bit signed integer from a foreign char buffer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type (alien (* char)) buf)
 	   (type fixnum offset))
   (the (signed-byte 32)
@@ -169,7 +169,7 @@
 #+(or cmu sbcl)
 (defun read-uint (buf offset)
   "Read a 32-bit unsigned integer from a foreign char buffer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type (alien (* char)) buf)
 	   (type fixnum offset))
   (the (unsigned-byte 32)
@@ -179,7 +179,7 @@
 #+(or cmu sbcl)
 (defun read-float (buf offset)
   "Read a single-float from a foreign char buffer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type (alien (* char)) buf)
 	   (type fixnum offset))
   (the single-float
@@ -189,7 +189,7 @@
 #+(or cmu sbcl)
 (defun read-double (buf offset)
   "Read a double-float from a foreign char buffer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type (alien (* char)) buf)
 	   (type fixnum offset))
   (the double-float
@@ -199,7 +199,7 @@
 #+(or cmu sbcl)
 (defun write-int (buf num offset)
   "Write a 32-bit signed integer to a foreign char buffer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type (alien (* char)) buf)
 	   (type (signed-byte 32) num)
 	   (type fixnum offset))
@@ -209,7 +209,7 @@
 #+(or cmu sbcl)
 (defun write-uint (buf num offset)
   "Write a 32-bit unsigned integer to a foreign char buffer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type (alien (* char)) buf)
 	   (type (unsigned-byte 32) num)
 	   (type fixnum offset))
@@ -219,7 +219,7 @@
 #+(or cmu sbcl)
 (defun write-float (buf num offset)
   "Write a single-float to a foreign char buffer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type (alien (* char)) buf)
 	   (type single-float num)
 	   (type fixnum offset))
@@ -229,7 +229,7 @@
 #+(or cmu sbcl)
 (defun write-double (buf num offset)
   "Write a double-float to a foreign char buffer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type (alien (* char)) buf)
 	   (type double-float num)
 	   (type fixnum offset))
@@ -239,7 +239,7 @@
 #+(or cmu sbcl)
 (defun offset-char-pointer (p offset)
   "Pointer arithmetic."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type (alien (* char)) p)
 	   (type fixnum offset))
   (sap-alien (sap+ (alien-sap p) offset) (* char)))
@@ -345,7 +345,7 @@
 
 #+(or cmu sbcl scl)
 (defun copy-str-to-buf (d do s so l)
-   (declare (optimize (speed 3) (safety 0))
+   (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
  	   (type array-or-pointer-char d)
  	   (type fixnum do so l)
  	   (type string s))
@@ -360,7 +360,7 @@
 #+openmcl
 (defun copy-str-to-buf (dest dest-offset src src-offset length)
   "Copy a string to a foreign buffer.  From Gary Byers."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type string src)
 	   (type array-or-pointer-char dest)
 	   (type fixnum length src-offset dest-offset)
@@ -374,7 +374,7 @@
 ;; (defun copy-str-to-buf (dest dest-offset src src-offset length)
 ;;   "Use build-in unicode handling and copying facilities.
 ;;    NOTE: We need to validate the speed of this vs. default."
-;;   (declare (optimize (speed 3) (safety 0))
+;;   (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 ;; 	   (type string src)
 ;; 	   (type array-or-pointer-char dest)
 ;; 	   (type fixnum length src-offset dest-offset)
@@ -386,7 +386,7 @@
 #+(not (or cmu sbcl scl openmcl lispworks))
 (defun copy-str-to-buf (dest dest-offset src src-offset length)
   "Copy a string to a foreign buffer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type string src)
 	   (type array-or-pointer-char dest)
 	   (type fixnum length src-offset dest-offset)
@@ -419,7 +419,7 @@
 
 (defun resize-buffer-stream (bs length)
   "Resize the underlying buffer of a buffer-stream, copying the old data."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type fixnum length))
   (with-struct-slots ((buf buffer-stream-buffer)
@@ -441,7 +441,7 @@
 
 (defun resize-buffer-stream-no-copy (bs length)
   "Resize the underlying buffer of a buffer-stream."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type fixnum length))
   (with-struct-slots ((buf buffer-stream-buffer)
@@ -461,14 +461,14 @@
 
 (defun reset-buffer-stream (bs)
   "'Empty' the buffer-stream."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs))
   (setf (buffer-stream-size bs) 0)
   (setf (buffer-stream-position bs) 0))
 
 (defun buffer-write-byte (b bs)
   "Write a byte."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type (unsigned-byte 8) b))
   (with-struct-slots ((buf buffer-stream-buffer)
@@ -483,7 +483,7 @@
 
 (defun buffer-write-int (i bs)
   "Write a 32-bit signed integer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type (signed-byte 32) i))
   (with-struct-slots ((buf buffer-stream-buffer)
@@ -499,7 +499,7 @@
 
 (defun buffer-write-uint (u bs)
   "Write a 32-bit unsigned integer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type (unsigned-byte 32) u))
   (with-struct-slots ((buf buffer-stream-buffer)
@@ -515,7 +515,7 @@
 
 (defun buffer-write-float (d bs)
   "Write a single-float."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type single-float d))
   (with-struct-slots ((buf buffer-stream-buffer)
@@ -531,7 +531,7 @@
 
 (defun buffer-write-double (d bs)
   "Write a double-float."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type double-float d))
   (with-struct-slots ((buf buffer-stream-buffer)
@@ -548,7 +548,7 @@
 (defun buffer-write-string (s bs)
   "Write the underlying bytes of a string.  On Unicode
 Lisps, this is a 16-bit operation."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type string s))
   (with-struct-slots ((buf buffer-stream-buffer)
@@ -577,7 +577,7 @@
 
 (defun buffer-read-byte (bs)
   "Read a byte."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs))
   (let ((position (buffer-stream-position bs)))
     (incf (buffer-stream-position bs))
@@ -586,7 +586,7 @@
 
 (defun buffer-read-byte-vector (bs)
    "Read the whole buffer into  byte vector."
-   (declare (optimize (speed 3) (safety 0))
+   (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
  	   (type buffer-stream bs))
    (let* ((position (buffer-stream-position bs))
  	(size (buffer-stream-size bs))
@@ -599,7 +599,7 @@
  
 (defun buffer-write-byte-vector (bs bv)
    "Read the whole buffer into  byte vector."
-   (declare (optimize (speed 3) (safety 0))
+   (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
  	   (type buffer-stream bs))
    (let* ((position (buffer-stream-position bs))
  	 (size (buffer-stream-size bs))
@@ -611,7 +611,7 @@
 
 (defun buffer-read-fixnum (bs)
   "Read a 32-bit signed integer, which is assumed to be a fixnum."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs))
   (let ((position (buffer-stream-position bs)))
     (setf (buffer-stream-position bs) (+ position 4))
@@ -619,7 +619,7 @@
 
 (defun buffer-read-int (bs)
   "Read a 32-bit signed integer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs))
   (let ((position (buffer-stream-position bs)))
     (setf (buffer-stream-position bs) (+ position 4))
@@ -627,7 +627,7 @@
 
 (defun buffer-read-uint (bs)
   "Read a 32-bit unsigned integer."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs))
   (let ((position (buffer-stream-position bs)))
     (setf (buffer-stream-position bs) (+ position 4))
@@ -635,7 +635,7 @@
 
 (defun buffer-read-float (bs)
   "Read a single-float."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs))
   (let ((position (buffer-stream-position bs)))
     (setf (buffer-stream-position bs) (+ position 4))
@@ -643,7 +643,7 @@
 
 (defun buffer-read-double (bs)
   "Read a double-float."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs))
   (let ((position (buffer-stream-position bs)))
     (setf (buffer-stream-position bs) (+ position 8))
@@ -662,7 +662,7 @@
 
 (defun buffer-read-ucs1-string (bs byte-length)
   "Read a UCS1 string."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type fixnum byte-length))
   (let ((position (buffer-stream-position bs)))
@@ -692,7 +692,7 @@
 #+(or lispworks (and allegro ics))
 (defun buffer-read-ucs2-string (bs byte-length)
   "Read a UCS2 string."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type fixnum byte-length))
   (let ((position (buffer-stream-position bs)))
@@ -711,7 +711,7 @@
 #+(and sbcl sb-unicode)
 (defun buffer-read-ucs4-string (bs byte-length)
   "Read a UCS4 string."
-  (declare (optimize (speed 3) (safety 0))
+  (declare #-elephant-without-optimize(optimize (speed 3) (safety 0))
 	   (type buffer-stream bs)
 	   (type fixnum byte-length))
   (let ((position (buffer-stream-position bs)))
Index: tests/testsorter.lisp
===================================================================
RCS file: /project/elephant/cvsroot/elephant/tests/testsorter.lisp,v
retrieving revision 1.3
diff -u -r1.3 testsorter.lisp
--- tests/testsorter.lisp	11 Nov 2006 18:41:11 -0000	1.3
+++ tests/testsorter.lisp	22 Nov 2006 01:36:05 -0000
@@ -55,14 +55,14 @@
   :returning :double)
 
 (defun read-num (num)
-  (declare (optimize (speed 3))
+  (declare #-elephant-without-optimize(optimize (speed 3))
 	   (type integer num))
   (with-buffer-streams (nb)
     (serialize num nb)
     (%read-num (buffer-stream-buffer nb))))
 
 (defun num-test (num) 
-  (declare (optimize (speed 3)) (type integer num))
+  (declare #-elephant-without-optimize(optimize (speed 3)) (type integer num))
   (loop with i of-type double-float = 0.0d0
 	for j fixnum from 0 below (ceiling (/ (integer-length num) 32))
 	for bs = (byte 32 (* j 32))
@@ -73,7 +73,7 @@
 
 
 (defun find-bad-num (bot top)
-  (declare (optimize (speed 3))
+  (declare #-elephant-without-optimize(optimize (speed 3))
 	   (type integer bot top))
   (cond ((= bot top) bot)
 	((= bot (- top 1))
@@ -85,7 +85,7 @@
 	       (find-bad-num bot middle))))))
 	
 (defun rfind-bad-num (bot top)
-  (declare (optimize (speed 3))
+  (declare #-elephant-without-optimize(optimize (speed 3))
 	   (type integer bot top))
   (cond ((= bot top) bot)
 	((= bot (- top 1))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20061122/27beb986/attachment.sig>


More information about the elephant-devel mailing list