]> git.eshelyaron.com Git - emacs.git/commitdiff
* Have `benchmark-run-compiled' use the native compiler when available
authorAndrea Corallo <akrl@sdf.org>
Thu, 27 Jan 2022 09:39:53 +0000 (10:39 +0100)
committerAndrea Corallo <akrl@sdf.org>
Thu, 27 Jan 2022 10:55:21 +0000 (11:55 +0100)
* lisp/emacs-lisp/benchmark.el (benchmark-run-compiled): Use native
compiler when available.

lisp/emacs-lisp/benchmark.el

index c5f621c6c863ad3e69afad062a06a11702b5e66d..882b1d68c48208dcfb40c78771221a0072841a43 100644 (file)
@@ -121,7 +121,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)