branch: externals/elisp-benchmarks commit fe6aa3ec9ca5f7568d7a1e5005382343b3bd9143 Author: Andrea Corallo <a...@sdf.org> Commit: Andrea Corallo <a...@sdf.org>
* Use the Emacs native compiler if available * elisp-benchmarks.el: Update version. (elisp-benchmarks-run): Use native compiler if available. --- elisp-benchmarks.el | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/elisp-benchmarks.el b/elisp-benchmarks.el index 5ac9b44..9e70620 100644 --- a/elisp-benchmarks.el +++ b/elisp-benchmarks.el @@ -4,7 +4,7 @@ ;; Author: Andrea Corallo <a...@sdf.org> ;; Maintainer: Andrea Corallo <a...@sdf.org> -;; Version: 1.4 +;; Version: 1.5 ;; Keywords: languages, lisp ;; Package-Type: multi ;; Created: 2019-01-12 @@ -85,6 +85,10 @@ RECOMPILE all the benchmark folder when non nil." repeat runs for i from 1 named test-loop + with native-comp = (boundp 'comp-ctxt) ; FIXME when possible + with compile-function = (if native-comp + #'native-compile + #'byte-compile-file) with res = (make-hash-table :test #'equal) with sources = (directory-files elb-bench-directory t "\\.el$") with tests = (if selector @@ -93,9 +97,20 @@ RECOMPILE all the benchmark folder when non nil." collect (file-name-base f)) (mapcar #'file-name-base sources)) initially - (if recompile - (mapc (lambda (f) (byte-compile-file f t)) sources) - (mapc #'load (mapcar #'file-name-sans-extension sources))) + (when native-comp + (require 'comp) + (setf comp-speed 3)) + ;; Compile + (when recompile + (mapc (lambda (f) + (message "Compiling... %s" f) + (funcall compile-function f t)) + sources)) + ;; Load + (mapc #'load (mapcar (if native-comp + #'comp-output-filename + #'file-name-sans-extension) + sources)) (cl-loop for test in tests do (puthash test () res)) do