aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStefan Monnier2018-03-27 16:19:40 -0400
committerStefan Monnier2018-03-27 16:19:40 -0400
commit7bc31c1cd4b6a6eac0d29e31dbe3d208e2258ccf (patch)
treef518430c9d0998b05636965564750c5a30bbb659 /test
parentb56c56f203f8b066dd71e6ae6a254121b3ac3f08 (diff)
downloademacs-7bc31c1cd4b6a6eac0d29e31dbe3d208e2258ccf.tar.gz
emacs-7bc31c1cd4b6a6eac0d29e31dbe3d208e2258ccf.zip
(benchmark-run-compiled): Make it work like 'benchmark-run' again
* lisp/emacs-lisp/benchmark.el (benchmark-run): Add special case for nil repetitions.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/benchmark-tests.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/lisp/emacs-lisp/benchmark-tests.el b/test/lisp/emacs-lisp/benchmark-tests.el
index cba53aefc9f..26bd3ff08a8 100644
--- a/test/lisp/emacs-lisp/benchmark-tests.el
+++ b/test/lisp/emacs-lisp/benchmark-tests.el
@@ -28,18 +28,24 @@
28 (should (consp (benchmark-run 1 (setq m (1+ 0))))) 28 (should (consp (benchmark-run 1 (setq m (1+ 0)))))
29 (should (stringp (benchmark nil (1+ 0)))) 29 (should (stringp (benchmark nil (1+ 0))))
30 (should (stringp (benchmark 1 (1+ 0)))) 30 (should (stringp (benchmark 1 (1+ 0))))
31 (should (consp (benchmark-run-compiled nil (1+ 0)))) 31 (should (consp (benchmark-run-compiled (1+ 0))))
32 (should (consp (benchmark-run-compiled 1 (1+ 0)))) 32 (should (consp (benchmark-run-compiled 1 (1+ 0))))
33 ;; First test is heavier, must need longer time. 33 ;; First test is heavier, must need longer time.
34 (should (> (car (benchmark-run nil 34 (let ((count1 0)
35 (count2 0)
36 (repeat 2))
37 (ignore (benchmark-run (setq count1 (1+ count1))))
38 (ignore (benchmark-run repeat (setq count2 (1+ count2))))
39 (should (> count2 count1)))
40 (should (> (car (benchmark-run
35 (let ((n 100000)) (while (> n 1) (setq n (1- n)))))) 41 (let ((n 100000)) (while (> n 1) (setq n (1- n))))))
36 (car (benchmark-run nil (setq m (1+ 0)))))) 42 (car (benchmark-run (setq m (1+ 0))))))
37 (should (> (car (benchmark-run nil 43 (should (> (car (benchmark-run
38 (let ((n 100000)) (while (> n 1) (setq n (1- n)))))) 44 (let ((n 100000)) (while (> n 1) (setq n (1- n))))))
39 (car (benchmark-run nil (setq m (1+ 0)))))) 45 (car (benchmark-run (setq m (1+ 0))))))
40 (should (> (car (benchmark-run-compiled nil 46 (should (> (car (benchmark-run-compiled
41 (let ((n 100000)) (while (> n 1) (setq n (1- n)))))) 47 (let ((n 100000)) (while (> n 1) (setq n (1- n))))))
42 (car (benchmark-run-compiled nil (1+ 0))))) 48 (car (benchmark-run-compiled (1+ 0)))))
43 (setq str (benchmark nil '(let ((n 100000)) (while (> n 1) (setq n (1- n)))))) 49 (setq str (benchmark nil '(let ((n 100000)) (while (> n 1) (setq n (1- n))))))
44 (string-match "Elapsed time: \\([0-9.]+\\)" str) 50 (string-match "Elapsed time: \\([0-9.]+\\)" str)
45 (setq t-long (string-to-number (match-string 1 str))) 51 (setq t-long (string-to-number (match-string 1 str)))