X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Fbenchmarks.lisp;h=16e3e78f8b34cdc2ccc6f0db411302b09ace9654;hb=a0fcaf1774e6f423fd23c8daaab9afb8ecb4e03a;hp=eb218b6791441299881ae95bca36e7a06934a931;hpb=d26a044593b10e62d1ba1c7b80266f55bc100d5d;p=clsql.git diff --git a/tests/benchmarks.lisp b/tests/benchmarks.lisp index eb218b6..16e3e78 100644 --- a/tests/benchmarks.lisp +++ b/tests/benchmarks.lisp @@ -3,7 +3,7 @@ ;;;; File: benchmarks.lisp ;;;; Authors: Kevin Rosenberg ;;;; Created: 03/05/2004 -;;;; Updated: $Id: test-init.lisp 9212 2004-05-03 18:44:03Z kevin $ +;;;; Updated: $Id$ ;;;; ;;;; Benchmark suite ;;;; @@ -26,23 +26,24 @@ :type (string 100)) (c :initarg :c :type float))) - + (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)) + (*report-stream* report-stream) + (*sexp-report-stream* sexp-report-stream)) (unless specs (warn "Not running benchmarks because test configuration file is missing") (return-from run-benchmarks :skipped)) (load-necessary-systems specs) (dolist (db-type +all-db-types+) (dolist (spec (db-type-spec db-type specs)) - (do-benchmarks-for-backend db-type spec count)))) + (do-benchmarks-for-backend db-type spec count)))) (values)) (defun do-benchmarks-for-backend (db-type spec count) (test-connect-to-database db-type spec) - (write-report-banner "Benchmarks" db-type *report-stream*) + (write-report-banner "Benchmarks" db-type *report-stream* + (database-name-from-spec spec db-type)) (create-view-from-class 'bench) (benchmark-init) @@ -67,8 +68,19 @@ (time (dotimes (i n) (query "SELECT * FROM BENCH" :field-names nil))) - )) - - + (with-dataset *ds-employees* + (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-sys::class-slots (find-class 'employee-address)) + :key #'clsql-sys::slot-definition-name)) + (dbi (when slotdef (clsql-sys::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)))))