diff options
Diffstat (limited to 'lisp/emacs-lisp/benchmark.el')
-rw-r--r-- | lisp/emacs-lisp/benchmark.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el index 7535f0e2f51..4bf61abe54c 100644 --- a/lisp/emacs-lisp/benchmark.el +++ b/lisp/emacs-lisp/benchmark.el @@ -31,6 +31,7 @@ ;;; Code: +(require 'cl-lib) (eval-when-compile (require 'subr-x)) ;For `named-let'. (defmacro benchmark-elapse (&rest forms) @@ -121,7 +122,11 @@ result. The overhead of the `lambda's is accounted for." (unless (or (natnump repetitions) (and repetitions (symbolp repetitions))) (setq forms (cons repetitions forms) repetitions 1)) - `(benchmark-call (byte-compile '(lambda () ,@forms)) ,repetitions)) + `(benchmark-call (,(if (native-comp-available-p) + 'native-compile + 'byte-compile) + '(lambda () ,@forms)) + ,repetitions)) ;;;###autoload (defun benchmark (repetitions form) |