X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Fbenchmarks.lisp;h=c6b0be0cb7d5a7ac06b2c122b0a4b337dae0d6e0;hb=a6576bcf62dd1e710085ec74089d0730d599001b;hp=8c3a0ce62403a27c8868dca630e199e09e73e034;hpb=c55451302afa47365232b6f6ef533a8b9984e8d4;p=clsql.git diff --git a/tests/benchmarks.lisp b/tests/benchmarks.lisp index 8c3a0ce..c6b0be0 100644 --- a/tests/benchmarks.lisp +++ b/tests/benchmarks.lisp @@ -27,7 +27,7 @@ (c :initarg :c :type float))) -(defun run-benchmarks (&key (report-stream *standard-output*) (sexp-report-stream nil) (count 1000)) +(defun run-benchmarks (&key (report-stream *standard-output*) (sexp-report-stream nil) (count 10000)) (let ((specs (read-specs)) (*report-stream* report-stream) (*sexp-report-stream* sexp-report-stream)) @@ -42,6 +42,7 @@ (defun do-benchmarks-for-backend (db-type spec count) (test-connect-to-database db-type spec) + (test-initialise-database) (write-report-banner "Benchmarks" db-type *report-stream*) (create-view-from-class 'bench) @@ -50,7 +51,7 @@ (drop-view-from-class 'bench)) (defun benchmark-init () - (dotimes (i 100) + (dotimes (i 10) (execute-command "INSERT INTO BENCH (A,B,C) VALUES (123,'A Medium size string',3.14159)"))) (defun benchmark-selects (n) @@ -67,8 +68,17 @@ (time (dotimes (i n) (query "SELECT * FROM BENCH" :field-names nil))) - )) - - - + (format *report-stream* "~&~%*** JOINED OBJECT QUERY RETRIEVAL IMMEDIATE ***~%") + (time + (dotimes (i (truncate n 10)) + (mapcar #'(lambda (ea) (slot-value ea 'address)) (select 'employee-address :flatp t)))) + (format *report-stream* "~&~%*** JOINED OBJECT QUERY RETRIEVAL DEFERRED ***~%") + (let* ((slotdef (find 'address (clsql::class-slots (find-class 'employee-address)) + :key #'clsql::slot-definition-name)) + (dbi (when slotdef (clsql::view-class-slot-db-info slotdef)))) + (setf (gethash :retrieval dbi) :deferred) + (time + (dotimes (i (truncate n 10)) + (mapcar #'(lambda (ea) (slot-value ea 'address)) (select 'employee-address :flatp t)))) + (setf (gethash :retrieval dbi) :immediate))))