diff options
Diffstat (limited to 'lisp/emacs-lisp/benchmark.el')
-rw-r--r-- | lisp/emacs-lisp/benchmark.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el index 7535f0e2f51..dc7889c40a0 100644 --- a/lisp/emacs-lisp/benchmark.el +++ b/lisp/emacs-lisp/benchmark.el @@ -1,6 +1,6 @@ ;;; benchmark.el --- support for benchmarking code -*- lexical-binding: t -*- -;; Copyright (C) 2003-2022 Free Software Foundation, Inc. +;; Copyright (C) 2003-2023 Free Software Foundation, Inc. ;; Author: Dave Love <fx@gnu.org> ;; Keywords: lisp, extensions @@ -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) |