lol

Merge pull request #113730 from collares/parallel-trampolines

emacs: precompile trampolines in parallel

authored by

adisbladis and committed by
GitHub
e59a33db c62662c9

+8 -4
+8 -4
pkgs/applications/editors/emacs/generic.nix
··· 159 159 '' + lib.optionalString (nativeComp && withNS) '' 160 160 ln -snf $out/lib/emacs/*/native-lisp $out/Applications/Emacs.app/Contents/native-lisp 161 161 '' + lib.optionalString nativeComp '' 162 - $out/bin/emacs --batch \ 163 - -l comp --eval "(mapatoms (lambda (s) \ 164 - (when (subr-primitive-p (symbol-function s)) \ 165 - (comp-trampoline-compile s))))" 162 + echo "Generating native-compiled trampolines..." 163 + # precompile trampolines in parallel, but avoid spawning one process per trampoline. 164 + # 1000 is a rough lower bound on the number of trampolines compiled. 165 + $out/bin/emacs --batch --eval "(mapatoms (lambda (s) \ 166 + (when (subr-primitive-p (symbol-function s)) (print s))))" \ 167 + | xargs -n $((1000/NIX_BUILD_CORES + 1)) -P $NIX_BUILD_CORES \ 168 + $out/bin/emacs --batch -l comp --eval "(while argv \ 169 + (comp-trampoline-compile (intern (pop argv))))" 166 170 mkdir -p $out/share/emacs/native-lisp 167 171 $out/bin/emacs --batch \ 168 172 --eval "(add-to-list 'comp-eln-load-path \"$out/share/emacs/native-lisp\")" \