emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp d59607b 4/4: * Windows: Use NUMBER_OF_PROCESSORS env


From: Andrea Corallo
Subject: feature/native-comp d59607b 4/4: * Windows: Use NUMBER_OF_PROCESSORS environment variable.
Date: Sat, 23 May 2020 06:42:23 -0400 (EDT)

branch: feature/native-comp
commit d59607b68592fa709bd8466a3ac7300d280df83a
Author: Nicolás Bértolo <address@hidden>
Commit: Andrea Corallo <address@hidden>

    * Windows: Use NUMBER_OF_PROCESSORS environment variable.
    
    * lisp/emacs-lisp/comp.el (comp-effective-async-max-jobs): Use
    NUMBER_OF_PROCESSORS environment variable if system is Windows NT,
    "nproc" if it is in PATH or a default of 1.
---
 lisp/emacs-lisp/comp.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index e5d3be6..6c15213 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -2302,9 +2302,14 @@ processes from `comp-async-compilations'"
   (if (zerop comp-async-jobs-number)
       (or comp-num-cpus
           (setf comp-num-cpus
-                ;; Half of the CPUs or at least one.
-                ;; FIXME portable?
-                (max 1 (/ (string-to-number (shell-command-to-string "nproc"))
+                ;; FIXME: we already have a function to determine
+                ;; the number of processors, see get_native_system_info in 
w32.c.
+                ;; The result needs to be exported to Lisp.
+                (max 1 (/ (cond ((eq 'windows-nt system-type)
+                                 (string-to-number (getenv 
"NUMBER_OF_PROCESSORS")))
+                                ((executable-find "nproc")
+                                 (string-to-number (shell-command-to-string 
"nproc")))
+                                (t 1))
                           2))))
     comp-async-jobs-number))
 



reply via email to

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