Advertisement
Guest User

Untitled

a guest
Mar 28th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. (defclass counter ()
  2. ((value :initform 0 :accessor counter-value)))
  3.  
  4. (defgeneric m-inc (counter)
  5. (:method ((counter counter))
  6. (incf (counter-value counter))))
  7.  
  8. (defun f-inc (counter)
  9. (incf (counter-value counter)))
  10.  
  11.  
  12. (time (loop :with c := (make-instance 'counter)
  13. :repeat 1000000
  14. :do (m-inc c)
  15. :finally (return (counter-value c))))
  16.  
  17. (time (loop :with c := (make-instance 'counter)
  18. :repeat 1000000
  19. :do (f-inc c)
  20. :finally (return (counter-value c))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement