summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/benchmark.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2018-03-27 16:19:40 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2018-03-27 16:19:40 -0400
commit7bc31c1cd4b6a6eac0d29e31dbe3d208e2258ccf (patch)
treef518430c9d0998b05636965564750c5a30bbb659 /lisp/emacs-lisp/benchmark.el
parentb56c56f203f8b066dd71e6ae6a254121b3ac3f08 (diff)
downloademacs-7bc31c1cd4b6a6eac0d29e31dbe3d208e2258ccf.tar.gz
emacs-7bc31c1cd4b6a6eac0d29e31dbe3d208e2258ccf.tar.bz2
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 'lisp/emacs-lisp/benchmark.el')
-rw-r--r--lisp/emacs-lisp/benchmark.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el
index 2f4e38fe356..e062a1867a8 100644
--- a/lisp/emacs-lisp/benchmark.el
+++ b/lisp/emacs-lisp/benchmark.el
@@ -50,7 +50,7 @@ Return a list of the total elapsed time for execution, the number of
garbage collections that ran, and the time taken by garbage collection.
See also `benchmark-run-compiled'."
(declare (indent 1) (debug t))
- (unless (or (natnump repetitions) (symbolp repetitions))
+ (unless (or (natnump repetitions) (and repetitions (symbolp repetitions)))
(setq forms (cons repetitions forms)
repetitions 1))
(let ((i (make-symbol "i"))
@@ -74,7 +74,7 @@ This is like `benchmark-run', but what is timed is a funcall of the
byte code obtained by wrapping FORMS in a `lambda' and compiling the
result. The overhead of the `lambda's is accounted for."
(declare (indent 1) (debug t))
- (unless (natnump repetitions)
+ (unless (or (natnump repetitions) (and repetitions (symbolp repetitions)))
(setq forms (cons repetitions forms)
repetitions 1))
(let ((i (make-symbol "i"))
@@ -84,7 +84,7 @@ result. The overhead of the `lambda's is accounted for."
(lambda-code (byte-compile `(lambda ()))))
`(let ((,gc gc-elapsed)
(,gcs gcs-done))
- (list ,(if (> repetitions 1)
+ (list ,(if (or (symbolp repetitions) (> repetitions 1))
;; Take account of the loop overhead.
`(- (benchmark-elapse (dotimes (,i ,repetitions)
(funcall ,code)))