Function: projection--guess-parallelism

projection--guess-parallelism is a natively compiled function defined in projection-utils.el.

Signature

(projection--guess-parallelism JOBS)

Documentation

Query the available CPU cores respecting JOBS.

See projection-build-jobs for supported values for JOBS.

Source Code

;; Defined in /nix/store/j6y921qbdmdqxjnd43iibapbig3p4hai-emacs-packages-deps/share/emacs/site-lisp/elpa/projection-20260614.1822/projection-utils.el
;; General

(defun projection--guess-parallelism (jobs)
  "Query the available CPU cores respecting JOBS.
See `projection-build-jobs' for supported values for JOBS."
  (when jobs
    (pcase jobs
      ('ninja
       (pcase (num-processors)
         ((or 0 1) 1)
         (2 3)
         (_ (+ (num-processors) 2))))
      (-1 (num-processors))
      (-2 (/ (num-processors) 2))
      (0 nil)
      ((cl-type integer) jobs)
      (_ (projection--log :warning "Unsupported `jobs' argument: %S." jobs)
         nil))))