emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/elisp-benchmarks 8e8af88 2/4: Make `comp-speed' control


From: Andrea Corallo
Subject: [elpa] externals/elisp-benchmarks 8e8af88 2/4: Make `comp-speed' controllable through a customize
Date: Tue, 16 Mar 2021 05:06:50 -0400 (EDT)

branch: externals/elisp-benchmarks
commit 8e8af88be9da9979565f8bc020876849000eb2bb
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    Make `comp-speed' controllable through a customize
---
 elisp-benchmarks.el | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/elisp-benchmarks.el b/elisp-benchmarks.el
index 0d7eaaa..4af5dbb 100644
--- a/elisp-benchmarks.el
+++ b/elisp-benchmarks.el
@@ -46,6 +46,9 @@
 (require 'benchmark)
 (require 'outline)
 (require 'org)
+(if (featurep 'nativecomp)
+    (require 'comp)
+  (defvar comp-speed))
 
 (defgroup elb nil
   "Emacs Lisp benchmarks."
@@ -56,6 +59,11 @@
   :type 'number
   :group 'comp)
 
+(defcustom elb-speed 3
+  "Default `comp-speed' to be used for native compiling the benchmarks."
+  :type 'number
+  :group 'elb)
+
 (defconst elb-bench-directory
   (concat (file-name-directory (or load-file-name buffer-file-name))
          "benchmarks/"))
@@ -85,8 +93,8 @@ RECOMPILE all the benchmark folder when non nil."
           repeat runs
           for i from 1
           named test-loop
-          with native-comp = (featurep 'nativecomp)
-          with compile-function = (if native-comp
+          with comp-speed = elb-speed
+          with compile-function = (if (featurep 'nativecomp)
                                       #'native-compile
                                     #'byte-compile-file)
           with res = (make-hash-table :test #'equal)
@@ -97,9 +105,6 @@ RECOMPILE all the benchmark folder when non nil."
                                       collect (file-name-base f))
                          (mapcar #'file-name-base sources))
           initially
-          (when native-comp
-            (require 'comp)
-            (setf comp-speed 3))
           ;; Compile
           (when recompile
             (mapc (lambda (f)
@@ -107,7 +112,7 @@ RECOMPILE all the benchmark folder when non nil."
                     (funcall compile-function f))
                   sources))
           ;; Load
-          (mapc #'load (mapcar (if native-comp
+          (mapc #'load (mapcar (if (featurep 'nativecomp)
                                    #'comp-el-to-eln-filename
                                  #'file-name-sans-extension)
                                sources))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]