diff options
author | adisbladis <adisbladis@gmail.com> | 2021-02-20 12:48:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-20 12:48:01 +0100 |
commit | e59a33db58feb4d4c0c58cee6d859a85324110dc (patch) | |
tree | e3e713262617cf54f197e312e5129e0d8b2b3a86 /pkgs | |
parent | c62662c962ef4e5aa392896c611cf5e1ce683f68 (diff) | |
parent | 4d60e14ad247a134822b05b0bce29f5641d1ee6f (diff) | |
download | nixpkgs-e59a33db58feb4d4c0c58cee6d859a85324110dc.tar nixpkgs-e59a33db58feb4d4c0c58cee6d859a85324110dc.tar.gz nixpkgs-e59a33db58feb4d4c0c58cee6d859a85324110dc.tar.bz2 nixpkgs-e59a33db58feb4d4c0c58cee6d859a85324110dc.tar.lz nixpkgs-e59a33db58feb4d4c0c58cee6d859a85324110dc.tar.xz nixpkgs-e59a33db58feb4d4c0c58cee6d859a85324110dc.tar.zst nixpkgs-e59a33db58feb4d4c0c58cee6d859a85324110dc.zip |
Merge pull request #113730 from collares/parallel-trampolines
emacs: precompile trampolines in parallel
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/applications/editors/emacs/generic.nix | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/pkgs/applications/editors/emacs/generic.nix b/pkgs/applications/editors/emacs/generic.nix index 619bde59874..70e253dd6df 100644 --- a/pkgs/applications/editors/emacs/generic.nix +++ b/pkgs/applications/editors/emacs/generic.nix @@ -159,10 +159,14 @@ let emacs = stdenv.mkDerivation (lib.optionalAttrs nativeComp { '' + lib.optionalString (nativeComp && withNS) '' ln -snf $out/lib/emacs/*/native-lisp $out/Applications/Emacs.app/Contents/native-lisp '' + lib.optionalString nativeComp '' - $out/bin/emacs --batch \ - -l comp --eval "(mapatoms (lambda (s) \ - (when (subr-primitive-p (symbol-function s)) \ - (comp-trampoline-compile s))))" + echo "Generating native-compiled trampolines..." + # precompile trampolines in parallel, but avoid spawning one process per trampoline. + # 1000 is a rough lower bound on the number of trampolines compiled. + $out/bin/emacs --batch --eval "(mapatoms (lambda (s) \ + (when (subr-primitive-p (symbol-function s)) (print s))))" \ + | xargs -n $((1000/NIX_BUILD_CORES + 1)) -P $NIX_BUILD_CORES \ + $out/bin/emacs --batch -l comp --eval "(while argv \ + (comp-trampoline-compile (intern (pop argv))))" mkdir -p $out/share/emacs/native-lisp $out/bin/emacs --batch \ --eval "(add-to-list 'comp-eln-load-path \"$out/share/emacs/native-lisp\")" \ |