X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fpcl%2Ftime.lisp;h=98a6b898de327de01db40ef6dbf39970a243700b;hb=f7c047cafd84b556398014c4932c90dba55a5c0d;hp=717fd33977fe71c049618c334fc1dd2081e40b54;hpb=cea4896b2482b7b2b429c1631d774b4cfbc0efba;p=sbcl.git diff --git a/src/pcl/time.lisp b/src/pcl/time.lisp index 717fd33..98a6b89 100644 --- a/src/pcl/time.lisp +++ b/src/pcl/time.lisp @@ -19,76 +19,76 @@ (defvar str (make-instance 'str)) (push (cons "Time unoptimized slot-value. This is case (1) from notes.text. (standard)" - '(time-slot-value m 'plist 10000)) + '(time-slot-value m 'plist 10000)) *tests*) (push (cons "Time unoptimized slot-value. This is case (1) from notes.text. (standard)" - '(time-slot-value m 'generic-function 10000)) + '(time-slot-value m '%generic-function 10000)) *tests*) (push (cons "Time unoptimized slot-value. This is case (1) from notes.text. (structure)" - '(time-slot-value str 'slot 10000)) + '(time-slot-value str 'slot 10000)) *tests*) (defun time-slot-value (object slot-name n) (time (dotimes-fixnum (i n) (slot-value object slot-name)))) (push (cons "Time optimized slot-value outside of a defmethod. Case (2). (standard)" - '(time-slot-value-function m 10000)) + '(time-slot-value-function m 10000)) *tests*) (defun time-slot-value-function (object n) - (time (dotimes-fixnum (i n) (slot-value object 'function)))) + (time (dotimes-fixnum (i n) (slot-value object '%function)))) (push (cons "Time optimized slot-value outside of a defmethod. Case (2). (structure)" - '(time-slot-value-slot str 10000)) + '(time-slot-value-slot str 10000)) *tests*) (defun time-slot-value-slot (object n) (time (dotimes-fixnum (i n) (slot-value object 'slot)))) (push (cons "Time one-class dfun." - '(time-generic-function-methods gf 10000)) + '(time-generic-function-methods gf 10000)) *tests*) (defun time-generic-function-methods (object n) (time (dotimes-fixnum (i n) (generic-function-methods object)))) (push (cons "Time one-index dfun." - '(time-class-precedence-list c 10000)) + '(time-class-precedence-list c 10000)) *tests*) (defun time-class-precedence-list (object n) (time (dotimes-fixnum (i n) (class-precedence-list object)))) (push (cons "Time n-n dfun." - '(time-method-function m 10000)) + '(time-method-function m 10000)) *tests*) (defun time-method-function (object n) (time (dotimes-fixnum (i n) (method-function object)))) (push (cons "Time caching dfun." - '(time-class-slots c 10000)) + '(time-class-slots c 10000)) *tests*) (defun time-class-slots (object n) (time (dotimes-fixnum (i n) (class-slots object)))) (push (cons "Time typep for classes." - '(time-typep-standard-object m 10000)) + '(time-typep-standard-object m 10000)) *tests*) (defun time-typep-standard-object (object n) (time (dotimes-fixnum (i n) (typep object 'standard-object)))) (push (cons "Time default-initargs." - '(time-default-initargs (find-class 'plist-mixin) 1000)) + '(time-default-initargs (find-class 'plist-mixin) 1000)) *tests*) -(defun time-default-initargs (class n) - (time (dotimes-fixnum (i n) (default-initargs class nil)))) +(defun time-default-initargs (n) + (time (dotimes-fixnum (i n) (default-initargs nil nil)))) (push (cons "Time make-instance." - '(time-make-instance (find-class 'plist-mixin) 1000)) + '(time-make-instance (find-class 'plist-mixin) 1000)) *tests*) (defun time-make-instance (class n) (time (dotimes-fixnum (i n) (make-instance class)))) (push (cons "Time constant-keys make-instance." - '(time-constant-keys-make-instance 1000)) + '(time-constant-keys-make-instance 1000)) *tests*) -(expanding-make-instance-top-level +(expanding-make-instance-toplevel (defun constant-keys-make-instance (n) (dotimes-fixnum (i n) (make-instance 'plist-mixin)))) @@ -98,48 +98,44 @@ (time (constant-keys-make-instance n))) (defun expand-all-macros (form) - (walk-form form nil #'(lambda (form context env) - (if (and (eq context :eval) - (consp form) - (symbolp (car form)) - (not (special-form-p (car form))) - (macro-function (car form))) - (values (macroexpand form env)) - form)))) + (walk-form form nil (lambda (form context env) + (if (eq context :eval) + (values (%macroexpand form env)) + form)))) (push (cons "Macroexpand meth-structure-slot-value" - '(pprint (multiple-value-bind (pgf pm) - (prototypes-for-make-method-lambda - 'meth-structure-slot-value) - (expand-defmethod - 'meth-structure-slot-value pgf pm - nil '((object str)) - '(#'(lambda () (slot-value object 'slot))) - nil)))) + '(pprint (multiple-value-bind (pgf pm) + (prototypes-for-make-method-lambda + 'meth-structure-slot-value) + (expand-defmethod + 'meth-structure-slot-value pgf pm + nil '((object str)) + '((lambda () (slot-value object 'slot))) + nil)))) *tests*) (push (cons "Show code for slot-value inside a defmethod for a structure-class. Case (3)." - '(disassemble (meth-structure-slot-value str))) + '(disassemble (meth-structure-slot-value str))) *tests*) (defmethod meth-structure-slot-value ((object str)) - #'(lambda () (slot-value object 'slot))) + (lambda () (slot-value object 'slot))) #|| ; interesting, but long. (produces 100 lines of output) (push (cons "Macroexpand meth-standard-slot-value" - '(pprint (expand-all-macros - (expand-defmethod-internal 'meth-standard-slot-value - nil '((object standard-method)) - '(#'(lambda () (slot-value object 'function))) - nil)))) + '(pprint (expand-all-macros + (expand-defmethod-internal 'meth-standard-slot-value + nil '((object standard-method)) + '((lambda () (slot-value object '%function))) + nil)))) *tests*) (push (cons "Show code for slot-value inside a defmethod for a standard-class. Case (4)." - '(disassemble (meth-standard-slot-value m))) + '(disassemble (meth-standard-slot-value m))) *tests*) (defmethod meth-standard-slot-value ((object standard-method)) - #'(lambda () (slot-value object 'function))) + (lambda () (slot-value object '%function))) ||# -(defun do-tests () +(defun run-tests () (dolist (doc+form (reverse *tests*)) (format t "~&~%~A~%" (car doc+form)) (pprint (cdr doc+form))