Skip to content
Snippets Groups Projects
Commit 3af22f92 authored by Raymond Toy's avatar Raymond Toy
Browse files

Add some timing code, but not for tests.

parent e6b95b82
No related branches found
No related tags found
No related merge requests found
......@@ -24,3 +24,33 @@
(prod-knuth (bignum::classical-multiply-bignums r1 r2))
(prod-hd (bignum::classical-multiply-bignum-hd r1 r2)))
(assert-equal prod-knuth prod-hd r1 r2))))))
;; Just for simple timing tests so we can redo the timing tests if needed.
#+nil
(define-test hd-timing
"Test execution time"
(:tag :bignum-tests)
(let ((rng (kernel::make-random-object :state
(kernel:init-random-state)
:rand 0 :cached-p nil))
(range (ash 1 128))
(reps 10000))
(flet ((gen-bignum (x sign)
(do ((r (random x rng) (random x rng)))
((typep r 'bignum)
(if (zerop sign)
r (- r))))))
(let* ((r1 (gen-bignum range 1))
(r2 (gen-bignum range 1)) res)
(time
(dotimes (k reps)
(declare (fixnum k)) (setf res
(bignum::classical-multiply-bignums r1 r2))))
(print res)
(time
(dotimes (k reps)
(declare (fixnum k)) (setf res
(bignum::classical-multiply-bignum-hd r1 r2))))
(print res)))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment