changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: xdb fixes (one test still broken), fixed cli main test

changeset 377: 49357f8b5e65
parent 374: d1d64b856fae
child 378: 2ef83f2178f1
author: Richard Westhaver <ellis@rwest.io>
date: Mon, 27 May 2024 23:14:09 -0400
files: lisp/lib/cli/cli.asd lisp/lib/cli/pkg.lisp lisp/lib/cli/tests.lisp lisp/lib/cli/tmux.lisp lisp/lib/rt/pkg.lisp lisp/lib/xdb/disk.lisp lisp/lib/xdb/pkg.lisp lisp/lib/xdb/tests.lisp
description: xdb fixes (one test still broken), fixed cli main test
     1.1--- a/lisp/lib/cli/cli.asd	Mon May 27 03:08:21 2024 -0400
     1.2+++ b/lisp/lib/cli/cli.asd	Mon May 27 23:14:09 2024 -0400
     1.3@@ -10,6 +10,7 @@
     1.4                (:file "repl" :depends-on ("pkg"))
     1.5                (:file "prompt" :depends-on ("env" "ansi"))
     1.6                (:file "ed" :depends-on ("env"))
     1.7+               (:file "tmux" :depends-on ("pkg"))
     1.8                (:file "clap" :depends-on ("shell" "progress" "spark" "repl" "prompt" "ed")))
     1.9   :in-order-to ((test-op (test-op "cli/tests"))))
    1.10 
     2.1--- a/lisp/lib/cli/pkg.lisp	Mon May 27 03:08:21 2024 -0400
     2.2+++ b/lisp/lib/cli/pkg.lisp	Mon May 27 23:14:09 2024 -0400
     2.3@@ -187,6 +187,10 @@
     2.4    :cli-version
     2.5    :cli-usage))
     2.6 
     2.7+(defpackage :cli/tmux
     2.8+  (:use :cl :std)
     2.9+  (:export))
    2.10+
    2.11 (uiop:define-package :cli
    2.12     (:use :cl :std)
    2.13   (:use-reexport :cli/shell :cli/ansi :cli/prompt
     3.1--- a/lisp/lib/cli/tests.lisp	Mon May 27 03:08:21 2024 -0400
     3.2+++ b/lisp/lib/cli/tests.lisp	Mon May 27 23:14:09 2024 -0400
     3.3@@ -198,8 +198,7 @@
     3.4   "Test CLI prompts"
     3.5   ;; TODO: needs to be compiled outside scope of test - contender for
     3.6   ;; fixture API
     3.7-  (compile
     3.8-   (defprompt tpfoo "testing: "))
     3.9+  (defprompt tpfoo "testing: ")
    3.10   (defvar tcoll nil)
    3.11   (defvar thist nil)
    3.12   (let ((*standard-input* (make-string-input-stream 
    3.13@@ -210,14 +209,14 @@
    3.14                  (completing-read "nothing: " tcoll :history thist :default "foobar")))))
    3.15 
    3.16 (defparameter *opts* (cli:make-opts
    3.17-                       (:name foo :global t :description "bar")
    3.18-		       (:name bar :description "foo")))
    3.19+                       (:name "foo" :global t :description "bar")
    3.20+		       (:name "bar" :description "foo")))
    3.21 
    3.22 (defparameter *cmd1* (make-cli :cmd :name "holla" :opts *opts* :description "cmd1 description"))
    3.23 (defparameter *cmd2* (make-cli :cmd :name "ayo" :cmds #(*cmd1*) :opts *opts* :description "cmd1 description"))
    3.24 (defparameter *cmds* (cli:make-cmds (:name "baz" :description "baz" :opts *opts*)))
    3.25 
    3.26-(defparameter *cli* (make-cli t :opts *opts* :cmds *cmds* :description "test cli"))
    3.27+(defparameter *cli* (make-cli :cli :opts *opts* :cmds *cmds* :description "test cli"))
    3.28 
    3.29 (deftest cli ()
    3.30   "test MACS.CLI OOS."
    3.31@@ -663,7 +662,7 @@
    3.32 (defvar *test-target* nil)
    3.33 
    3.34 (deftest main-output ()
    3.35-  (defmain (*test-target*)
    3.36+  (defmain (:return *test-target* :exit nil)
    3.37     (let ((*test-target* t))
    3.38       *test-target*))
    3.39   (compile 'main)
     4.1--- a/lisp/lib/cli/tmux.lisp	Mon May 27 03:08:21 2024 -0400
     4.2+++ b/lisp/lib/cli/tmux.lisp	Mon May 27 23:14:09 2024 -0400
     4.3@@ -0,0 +1,6 @@
     4.4+;;; cli/tmux.lisp --- Tmux Control from Lisp
     4.5+
     4.6+;; Control Tmux from Lisp
     4.7+
     4.8+;;; Code:
     4.9+(in-package :cli/tmux)
     5.1--- a/lisp/lib/rt/pkg.lisp	Mon May 27 03:08:21 2024 -0400
     5.2+++ b/lisp/lib/rt/pkg.lisp	Mon May 27 23:14:09 2024 -0400
     5.3@@ -603,7 +603,7 @@
     5.4   (do-suite *test-suite* :stream stream))
     5.5 
     5.6 ;;; Checks
     5.7-(eval-when (:compile-toplevel)
     5.8+(eval-always
     5.9   (defun %test (val &optional form)
    5.10     (let ((r
    5.11 	    (if val 
     6.1--- a/lisp/lib/xdb/disk.lisp	Mon May 27 03:08:21 2024 -0400
     6.2+++ b/lisp/lib/xdb/disk.lisp	Mon May 27 23:14:09 2024 -0400
     6.3@@ -24,7 +24,7 @@
     6.4 (eval-when (:compile-toplevel :load-toplevel :execute)
     6.5   (defparameter *codes*
     6.6     #(ascii-string
     6.7-      identifiable
     6.8+      id
     6.9       cons
    6.10       string
    6.11       null
    6.12@@ -140,7 +140,7 @@
    6.13    *collection*))
    6.14 
    6.15 (defun write-top-level-object (object stream)
    6.16-  (if (typep object 'identifiable)
    6.17+  (if (typep object 'id)
    6.18       (write-storable-object object stream)
    6.19       (write-object object stream)))
    6.20 
    6.21@@ -573,13 +573,13 @@
    6.22       (setf (slot-locations-and-initforms class) vector))
    6.23     (read-next-object stream)))
    6.24 
    6.25-;;; identifiable
    6.26+;;; Storable ID
    6.27 
    6.28-(defmethod write-object ((object identifiable) stream)
    6.29+(defmethod write-object ((object id) stream)
    6.30   (cond ((written object)
    6.31          (let* ((class (class-of object))
    6.32                 (class-id (write-object class stream)))
    6.33-           (write-n-bytes #.(type-code 'identifiable) 1 stream)
    6.34+           (write-n-bytes #.(type-code 'id) 1 stream)
    6.35            (write-n-bytes class-id +class-id-length+ stream)
    6.36            (write-n-bytes (id object) +id-length+ stream)))
    6.37         (t
    6.38@@ -598,7 +598,7 @@
    6.39         (setf (gethash id index)
    6.40               (fast-allocate-instance class)))))
    6.41 
    6.42-(defreader identifiable (stream)
    6.43+(defreader id (stream)
    6.44   (get-instance (read-n-bytes +class-id-length+ stream)
    6.45                 (read-n-bytes +id-length+ stream)))
    6.46 
     7.1--- a/lisp/lib/xdb/pkg.lisp	Mon May 27 03:08:21 2024 -0400
     7.2+++ b/lisp/lib/xdb/pkg.lisp	Mon May 27 23:14:09 2024 -0400
     7.3@@ -1,3 +1,3 @@
     7.4 (defpackage :xdb
     7.5-  (:use :cl :std :seq :db)
     7.6-  (:export :xdb :dbs))
     7.7+  (:use :cl :std :seq :db :obj/meta/storable :obj/id)
     7.8+  (:export :xdb :dbs :add-collection))
     8.1--- a/lisp/lib/xdb/tests.lisp	Mon May 27 03:08:21 2024 -0400
     8.2+++ b/lisp/lib/xdb/tests.lisp	Mon May 27 23:14:09 2024 -0400
     8.3@@ -1,229 +1,231 @@
     8.4 (defpackage :xdb/tests
     8.5-  (:use :cl :rt :obj/db :obj/id :xdb))
     8.6+  (:use :cl :rt :obj/db :obj/id :xdb :obj/meta/storable))
     8.7 
     8.8 (in-package :xdb/tests)
     8.9 (defsuite :xdb)
    8.10 (in-suite :xdb)
    8.11 
    8.12+(defparameter *tree* nil)
    8.13+
    8.14+(defclass test-doc-non-storable (id)
    8.15+  ((eid :initarg :eid)
    8.16+   (aa :initarg :aa)
    8.17+   (bb :initarg :bb)
    8.18+   (cc :initarg :cc)
    8.19+   (dd :initarg :dd)
    8.20+   (ee :initarg :ee)
    8.21+   (ff :initarg :ff)
    8.22+   (hh :initarg :hh)
    8.23+   (data :initarg :data
    8.24+         :initform (make-hash-table)
    8.25+         :accessor data)
    8.26+   (key :initarg :key
    8.27+        :initform nil
    8.28+        :accessor key)
    8.29+   (type :initarg :type
    8.30+         :initform nil)))
    8.31+
    8.32+(defclass test-doc-storable ()
    8.33+  ((eid :initarg :eid)
    8.34+   (aa :initarg :aa)
    8.35+   (bb :initarg :bb)
    8.36+   (cc :initarg :cc)
    8.37+   (dd :initarg :dd)
    8.38+   (ee :initarg :ee)
    8.39+   (ff :initarg :ff)
    8.40+   (hh :initarg :hh)
    8.41+   (data :initarg :data
    8.42+         :initform (make-hash-table)
    8.43+         :accessor data)
    8.44+   (key :initarg :key
    8.45+        :initform nil
    8.46+        :accessor key)
    8.47+   (type :initarg :type
    8.48+         :initform nil))
    8.49+  (:metaclass storable-class))
    8.50+
    8.51+(defun make-doc-test (type key data)
    8.52+  (let ((doc-obj (make-instance 'test-doc-storable :key key :type type)))
    8.53+    (dolist (pair data)
    8.54+      (setf (gethash (first pair) (data doc-obj)) (second pair)))
    8.55+    doc-obj))
    8.56+
    8.57+(defun test-store-doc (collection times)
    8.58+  (dotimes (i times)
    8.59+    (xdb::store-doc collection
    8.60+                    (make-doc-test
    8.61+                     "Test Doc"
    8.62+                     i
    8.63+                     (list
    8.64+                      (list "id" i)
    8.65+                      (list "eid" i)
    8.66+                      (list "aa" (format nil "~R" (random 51234)))
    8.67+                      (list "bb" (format nil "~R" (random 1234)))
    8.68+                      (list "cc" (format nil "~R" (random 1234)))
    8.69+                      (list "dd" (format nil "~R" (random 1234)))
    8.70+                      (list "ee" (format nil "~R" (random 1234)))
    8.71+                      (list "ff" (format nil "~R" (random 1234)))
    8.72+                      (list "gg" (format nil "~R" (random 1234)))
    8.73+                      (list "hh" (format nil "~R" (random 1234))))))))
    8.74+
    8.75+(defun db-test (n)
    8.76+  (let* ((db (make-instance 'xdb :location "/tmp/db-test/"))
    8.77+         (col (add-collection db "test" :load-from-file-p nil)))
    8.78+    (time (test-store-doc col n))
    8.79+    ;; (time (snapshot db))
    8.80+    ;; (time (sum col "eid"))
    8.81+    ;; (time (find-doc col "eid" 50))
    8.82+    ;; (time (sort-collection col))
    8.83+    ))
    8.84+
    8.85+(defun test-store-docx (collection times)
    8.86+  (dotimes (i times)
    8.87+
    8.88+    (xdb::store-doc collection  
    8.89+
    8.90+                    (make-doc-test 
    8.91+                     "Test Doc"
    8.92+                     i
    8.93+                     (list
    8.94+                      (list "id" i)
    8.95+                      (list "eid" i)
    8.96+                      (list "aa" (random 51234))
    8.97+                      (list "bb" (format nil "~R" (random 1234)))
    8.98+                      (list "cc" (format nil "~R" (random 1234)))
    8.99+                      (list "dd" (format nil "~R" (random 1234)))
   8.100+                      (list "ee" (format nil "~R" (random 1234)))
   8.101+                      (list "ff" (format nil "~R" (random 1234)))
   8.102+                      (list "gg" (format nil "~R" (random 1234)))
   8.103+                      (list "hh" (get-universal-time))))
   8.104+                    )
   8.105+
   8.106+    (if (equal (mod i 100000) 0)
   8.107+        (sb-ext:gc :full t))))
   8.108+
   8.109+(defun test-store-doc-storable-object (collection times)
   8.110+  (dotimes (i times)
   8.111+    (xdb::store-doc collection  
   8.112+                    (make-instance 'test-doc-storable :key i :type "Test Doc"
   8.113+                                   :id i
   8.114+                                   :eid i
   8.115+                                   :aa (random 51234)
   8.116+                                   :bb (format nil "~R" (random 1234))
   8.117+                                   :cc (format nil "~R" (random 1234))
   8.118+                                   :dd (format nil "~R" (random 1234))
   8.119+                                   :ee (format nil "~R" (random 1234))
   8.120+                                   :ff (format nil "~R" (random 1234))
   8.121+                                   :hh (get-universal-time))
   8.122+
   8.123+                    )
   8.124+
   8.125+    (if (equal (mod i 100000) 0)
   8.126+        (sb-ext:gc :full t))))
   8.127+
   8.128+(defun test-store-doc-non-storable-object (collection times)
   8.129+  (dotimes (i times)
   8.130+    (xdb::store-doc collection  
   8.131+                    (make-instance 'test-doc-non-storable :key i :type "Test Doc"
   8.132+                                   :id i
   8.133+                                   :eid i
   8.134+                                   :aa (random 51234)
   8.135+                                   :bb (format nil "~R" (random 1234))
   8.136+                                   :cc (format nil "~R" (random 1234))
   8.137+                                   :dd (format nil "~R" (random 1234))
   8.138+                                   :ee (format nil "~R" (random 1234))
   8.139+                                   :ff (format nil "~R" (random 1234))
   8.140+                                   :hh (get-universal-time))
   8.141+
   8.142+                    )
   8.143+
   8.144+    (if (equal (mod i 100000) 0)
   8.145+        (sb-ext:gc :full t))))
   8.146+
   8.147+(defun test-store-doc-hash (collection times)
   8.148+  (dotimes (i times)
   8.149+    (let ((hash (make-hash-table :test 'equal)))
   8.150+      (setf (gethash 'key hash) i)
   8.151+      (setf (gethash "id" hash) i)
   8.152+      (setf (gethash "eid" hash) i)
   8.153+      (setf (gethash "bb" hash) (format nil "~R" (random 1234)))
   8.154+      (setf (gethash "cc" hash) (format nil "~R" (random 1234)))
   8.155+      (setf (gethash "dd" hash) (format nil "~R" (random 1234)))
   8.156+      (setf (gethash "ee" hash) (format nil "~R" (random 1234)))
   8.157+      (setf (gethash "ff" hash) (format nil "~R" (random 1234)))
   8.158+      (setf (gethash "stamp" hash) (get-universal-time))
   8.159+      (xdb::store-doc collection hash))
   8.160+
   8.161+    (if (equal (mod i 100000) 0)
   8.162+        (sb-ext:gc :full t))))
   8.163+
   8.164+
   8.165+(defun test-store-doc-list (collection times)
   8.166+  (dotimes (i times)
   8.167+    (xdb::store-doc collection (list
   8.168+                                (list 'key i)
   8.169+                                (list "id" i)
   8.170+                                (list "eid" i)
   8.171+                                (list "aa" (random 51234))
   8.172+                                (list "bb" (format nil "~R" (random 1234)))
   8.173+                                (list "cc" (format nil "~R" (random 1234)))
   8.174+                                (list "dd" (format nil "~R" (random 1234)))
   8.175+                                (list "ee" (format nil "~R" (random 1234)))
   8.176+                                (list "ff" (format nil "~R" (random 1234)))
   8.177+                                (list "gg" (format nil "~R" (random 1234)))
   8.178+                                (list "stamp" (get-universal-time))))
   8.179+
   8.180+    (if (equal (mod i 100000) 0)
   8.181+        (sb-ext:gc :full t))))
   8.182+
   8.183+(defparameter db (make-instance 'xdb :location "/tmp/db-test/"))
   8.184+
   8.185+(defparameter col-hash (add-collection db "test-hash" :load-from-file-p nil))
   8.186+
   8.187+(defparameter col-list (add-collection db "test-list" :load-from-file-p nil))
   8.188+(defparameter col-object (add-collection db "test-object" :load-from-file-p nil))
   8.189+(defparameter col-object-storable (add-collection db "test-object-storable" :load-from-file-p nil))
   8.190+
   8.191 ;;; DB
   8.192 (deftest db ()
   8.193   "Test database protocol."
   8.194-  (defparameter *tree* nil)
   8.195-
   8.196-  (defclass test-doc-non-storable (id)
   8.197-    ((eid :initarg :eid)
   8.198-     (aa :initarg :aa)
   8.199-     (bb :initarg :bb)
   8.200-     (cc :initarg :cc)
   8.201-     (dd :initarg :dd)
   8.202-     (ee :initarg :ee)
   8.203-     (ff :initarg :ff)
   8.204-     (hh :initarg :hh)
   8.205-     (data :initarg :data
   8.206-           :initform (make-hash-table)
   8.207-           :accessor data)
   8.208-     (key :initarg :key
   8.209-          :initform nil
   8.210-          :accessor key)
   8.211-     (type :initarg :type
   8.212-           :initform nil))
   8.213-    )
   8.214-
   8.215-  (defclass test-doc-storable ()
   8.216-    ((eid :initarg :eid)
   8.217-     (aa :initarg :aa)
   8.218-     (bb :initarg :bb)
   8.219-     (cc :initarg :cc)
   8.220-     (dd :initarg :dd)
   8.221-     (ee :initarg :ee)
   8.222-     (ff :initarg :ff)
   8.223-     (hh :initarg :hh)
   8.224-     (data :initarg :data
   8.225-           :initform (make-hash-table)
   8.226-           :accessor data)
   8.227-     (key :initarg :key
   8.228-          :initform nil
   8.229-          :accessor key)
   8.230-     (type :initarg :type
   8.231-           :initform nil))
   8.232-    (:metaclass storable-class))
   8.233-
   8.234-  (defun make-doc-test (type key data)
   8.235-    (let ((doc-obj (make-instance 'test-doc-storable :key key :type type)))
   8.236-      (dolist (pair data)
   8.237-        (setf (gethash (first pair) (data doc-obj)) (second pair)))
   8.238-      doc-obj))
   8.239-
   8.240-  (defun test-store-doc (collection times)
   8.241-    (dotimes (i times)
   8.242-      (store-doc collection
   8.243-                 (make-doc-test
   8.244-                  "Test Doc"
   8.245-                  i
   8.246-                  (list
   8.247-                   (list "id" i)
   8.248-                   (list "eid" i)
   8.249-                   (list "aa" (format nil "~R" (random 51234)))
   8.250-                   (list "bb" (format nil "~R" (random 1234)))
   8.251-                   (list "cc" (format nil "~R" (random 1234)))
   8.252-                   (list "dd" (format nil "~R" (random 1234)))
   8.253-                   (list "ee" (format nil "~R" (random 1234)))
   8.254-                   (list "ff" (format nil "~R" (random 1234)))
   8.255-                   (list "gg" (format nil "~R" (random 1234)))
   8.256-                   (list "hh" (format nil "~R" (random 1234))))))))
   8.257-
   8.258-  (defun db-test (n)
   8.259-    (let* ((db (make-instance 'xdb :location "/tmp/db-test/"))
   8.260-           (col (add-collection db "test" :load-from-file-p nil)))
   8.261-      (time (test-store-doc col n))
   8.262-      ;; (time (snapshot db))
   8.263-      ;; (time (sum col "eid"))
   8.264-      ;; (time (find-doc col "eid" 50))
   8.265-      ;; (time (sort-collection col))
   8.266-      ))
   8.267-
   8.268-  (defun test-store-docx (collection times)
   8.269-    (dotimes (i times)
   8.270-
   8.271-      (store-doc collection  
   8.272-                 
   8.273-                 (make-doc-test 
   8.274-                  "Test Doc"
   8.275-                  i
   8.276-                  (list
   8.277-                   (list "id" i)
   8.278-                   (list "eid" i)
   8.279-                   (list "aa" (random 51234))
   8.280-                   (list "bb" (format nil "~R" (random 1234)))
   8.281-                   (list "cc" (format nil "~R" (random 1234)))
   8.282-                   (list "dd" (format nil "~R" (random 1234)))
   8.283-                   (list "ee" (format nil "~R" (random 1234)))
   8.284-                   (list "ff" (format nil "~R" (random 1234)))
   8.285-                   (list "gg" (format nil "~R" (random 1234)))
   8.286-                   (list "hh" (get-universal-time))))
   8.287-                 )
   8.288-      
   8.289-      (if (equal (mod i 100000) 0)
   8.290-          (sb-ext:gc :full t))))
   8.291-
   8.292-  (defun test-store-doc-storable-object (collection times)
   8.293-    (dotimes (i times)
   8.294-      (store-doc collection  
   8.295-                 (make-instance 'test-doc-storable :key i :type "Test Doc"
   8.296-                                :id i
   8.297-                                :eid i
   8.298-                                :aa (random 51234)
   8.299-                                :bb (format nil "~R" (random 1234))
   8.300-                                :cc (format nil "~R" (random 1234))
   8.301-                                :dd (format nil "~R" (random 1234))
   8.302-                                :ee (format nil "~R" (random 1234))
   8.303-                                :ff (format nil "~R" (random 1234))
   8.304-                                :hh (get-universal-time))
   8.305-                 
   8.306-                 )
   8.307-      
   8.308-      (if (equal (mod i 100000) 0)
   8.309-          (sb-ext:gc :full t))))
   8.310-
   8.311-  (defun test-store-doc-non-storable-object (collection times)
   8.312-    (dotimes (i times)
   8.313-      (store-doc collection  
   8.314-                 (make-instance 'test-doc-non-storable :key i :type "Test Doc"
   8.315-                                :id i
   8.316-                                :eid i
   8.317-                                :aa (random 51234)
   8.318-                                :bb (format nil "~R" (random 1234))
   8.319-                                :cc (format nil "~R" (random 1234))
   8.320-                                :dd (format nil "~R" (random 1234))
   8.321-                                :ee (format nil "~R" (random 1234))
   8.322-                                :ff (format nil "~R" (random 1234))
   8.323-                                :hh (get-universal-time))
   8.324-                 
   8.325-                 )
   8.326-      
   8.327-      (if (equal (mod i 100000) 0)
   8.328-          (sb-ext:gc :full t))))
   8.329-
   8.330-  (defun test-store-doc-hash (collection times)
   8.331-    (dotimes (i times)
   8.332-      (let ((hash (make-hash-table :test 'equal)))
   8.333-        (setf (gethash 'key hash) i)
   8.334-        (setf (gethash "id" hash) i)
   8.335-        (setf (gethash "eid" hash) i)
   8.336-        (setf (gethash "bb" hash) (format nil "~R" (random 1234)))
   8.337-        (setf (gethash "cc" hash) (format nil "~R" (random 1234)))
   8.338-        (setf (gethash "dd" hash) (format nil "~R" (random 1234)))
   8.339-        (setf (gethash "ee" hash) (format nil "~R" (random 1234)))
   8.340-        (setf (gethash "ff" hash) (format nil "~R" (random 1234)))
   8.341-        (setf (gethash "stamp" hash) (get-universal-time))
   8.342-        (store-doc collection hash))
   8.343-      
   8.344-      (if (equal (mod i 100000) 0)
   8.345-          (sb-ext:gc :full t))))
   8.346-
   8.347-
   8.348-  (defun test-store-doc-list (collection times)
   8.349-    (dotimes (i times)
   8.350-      (store-doc collection (list
   8.351-                             (list 'key i)
   8.352-                             (list "id" i)
   8.353-                             (list "eid" i)
   8.354-                             (list "aa" (random 51234))
   8.355-                             (list "bb" (format nil "~R" (random 1234)))
   8.356-                             (list "cc" (format nil "~R" (random 1234)))
   8.357-                             (list "dd" (format nil "~R" (random 1234)))
   8.358-                             (list "ee" (format nil "~R" (random 1234)))
   8.359-                             (list "ff" (format nil "~R" (random 1234)))
   8.360-                             (list "gg" (format nil "~R" (random 1234)))
   8.361-                             (list "stamp" (get-universal-time))))
   8.362-      
   8.363-      (if (equal (mod i 100000) 0)
   8.364-          (sb-ext:gc :full t))))
   8.365-
   8.366-  (defparameter db (make-instance 'xdb :location "/tmp/db-test/"))
   8.367-
   8.368-  (defparameter col-hash (add-collection db "test-hash" :load-from-file-p nil))
   8.369   (format t "Hash Test~%")
   8.370   (format t "Store~%")
   8.371   (time (test-store-doc-hash col-hash 10000))
   8.372   (format t "Sum~%")
   8.373-  (time (sum col-hash :element "id"))
   8.374+  (time (xdb::sum col-hash :element "id"))
   8.375   (format t "Find~%")
   8.376-  (time (find-doc col-hash :test (lambda (doc) (equal (get-val doc "id") 500))))
   8.377+  (time (xdb::find-doc col-hash :test (lambda (doc) (equal (get-val doc "id") 500))))
   8.378   (format t "Sort~%")
   8.379-  (time (sort-collection col-hash))
   8.380-
   8.381-  (defparameter col-list (add-collection db "test-list" :load-from-file-p nil))
   8.382+  (time (xdb::sort-collection col-hash))
   8.383   (format t "List Test~%")
   8.384   (format t "Store~%")
   8.385   (time (test-store-doc-list col-list 10000))
   8.386   (format t "Sum~%")
   8.387-  (time (sum col-list :element "id"))
   8.388+  (time (xdb::sum col-list :element "id"))
   8.389   (format t "Find~%")
   8.390-  (time (find-doc col-list :test (lambda (doc) (equal (get-val doc "id") 500))))
   8.391+  (time (xdb::find-doc col-list :test (lambda (doc) (equal (get-val doc "id") 500))))
   8.392   (format t "Sort~%")
   8.393-  (time (sort-collection col-list))
   8.394+  (time (xdb::sort-collection col-list))
   8.395 
   8.396-  (defparameter col-object (add-collection db "test-object" :load-from-file-p nil))
   8.397+
   8.398   (format t "Object non storable Test~%")
   8.399   (format t "Store~%")
   8.400   (time (test-store-doc-non-storable-object col-object 10000))
   8.401   (format t "Sum~%")
   8.402-  (time (sum col-object :element 'id))
   8.403+  (time (xdb::sum col-object :element 'id))
   8.404   (format t "Find~%")
   8.405-  (time (find-doc col-object :test (lambda (doc) (equal (get-val doc 'id) 500))))
   8.406+  (time (xdb::find-doc col-object :test (lambda (doc) (equal (get-val doc 'id) 500))))
   8.407   (format t "Sort~%")
   8.408-  (time (sort-collection col-object))
   8.409+  (time (xdb::sort-collection col-object))
   8.410 
   8.411-  (defparameter col-object-storable (add-collection db "test-object-storable" :load-from-file-p nil))
   8.412-  (setf *fsync-data* nil)
   8.413+
   8.414+  (setf xdb::*fsync-data* nil)
   8.415   (format t "Object storable Test~%")
   8.416   (format t "Store~%")
   8.417   (time (test-store-doc-storable-object col-object-storable 10000))
   8.418   (format t "Sum~%")
   8.419-  (time (sum col-object-storable :element 'id))
   8.420+  (time (xdb::sum col-object-storable :element 'id))
   8.421   (format t "Find~%")
   8.422-  (time (find-doc col-object-storable :test (lambda (doc) (equal (get-val doc 'id) 500))))
   8.423+  (time (xdb::find-doc col-object-storable :test (lambda (doc) (equal (get-val doc 'id) 500))))
   8.424   (format t "Sort~%")
   8.425-  (time (sort-collection col-object-storable))
   8.426-  (time (db::sort-collection-temporary col-object-storable)))
   8.427+  (time (xdb::sort-collection col-object-storable)))
   8.428+