I am using https://www.emacswiki.org/emacs/GccEmacs :
GccEmacs refers to the --with-native-compilation configuration option when building Emacs, which adds support for compiling EmacsLisp to native code using libgccjit. All of the Elisp packages shipped with Emacs are native-compiled, providing a noticeable performance improvement out-of-the-box. Third-party packages are also compiled to achieve further performance improvements.
The way I installed emacs, please note that -b feature/native-comp
flag is mentioned in https://akrl.sdf.org/gccemacs.html#orgf5ebdd1:
# git clone git://git.savannah.gnu.org/emacs.git # for the master branch
git clone git://git.savannah.gnu.org/emacs.git -b feature/native-comp
cd emacs
./autogen.sh
./configure --with-native-compilation CPPFLAGS='-fgnu89-inline' \
--with-x-toolkit=no --with-xml2 --with-jpeg=ifavailable \
--with-tiff=ifavailable --with-gnutls=ifavailable --with-mailutils
make -j$(nproc)
sudo mkdir -p /opt/ss
sudo rm -f /opt/ss/*
sudo ln -s ~/tools/emacs/lib-src/emacsclient /opt/ss/
sudo ln -s ~/tools/emacs/src/emacs /opt/ss/
$ emacs --version
GNU Emacs 29.0.50
I have following lines related to native-compile
in my config file:
(setq native-comp-deferred-compilation t)
(setq package-native-compile t)
(setq comp-async-report-warnings-errors nil)
When I start my emacs server in the *Async-native-compile-log*
buffer I keep seeing following compilation log, compilation takes around 2-3 minutes:
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/bytecomp.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/byte-opt.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/subr-x.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/gv.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/help-mode.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/cl-macs.el’ newer than byte-compiled file; using older file
Compiling /home/alper/tools/emacs/lisp/emacs-lisp/seq.el...
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/bytecomp.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/byte-opt.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/subr-x.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/gv.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/help-mode.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/cl-macs.el’ newer than byte-compiled file; using older file
Compiling /home/alper/tools/emacs/lisp/emacs-lisp/bytecomp.el...
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/bytecomp.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/byte-opt.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/subr-x.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/gv.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/help-mode.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/cl-macs.el’ newer than byte-compiled file; using older file
Compiling /home/alper/tools/emacs/lisp/emacs-lisp/byte-opt.el...
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/bytecomp.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/byte-opt.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/subr-x.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/gv.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/help-mode.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/cl-macs.el’ newer than byte-compiled file; using older file
Compiling /home/alper/tools/emacs/lisp/emacs-lisp/subr-x.el...
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/bytecomp.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/byte-opt.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/subr-x.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/gv.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/help-mode.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/cl-macs.el’ newer than byte-compiled file; using older file
Compiling /home/alper/tools/emacs/lisp/emacs-lisp/gv.el...
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/bytecomp.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/byte-opt.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/subr-x.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/gv.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/help-mode.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/cl-macs.el’ newer than byte-compiled file; using older file
Compiling /home/alper/tools/emacs/lisp/url/url-vars.el...
// ... many more ...
Compiling /home/alper/.emacs.d/elpa/flycheck-pycheckers-20211122.235/flycheck-pycheckers.el...
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/bytecomp.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/byte-opt.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/subr-x.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/seq.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/gv.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/help-mode.el’ newer than byte-compiled file; using older file
Source file ‘/home/alper/tools/emacs/lisp/emacs-lisp/cl-macs.el’ newer than byte-compiled file; using older file
Compiling /home/alper/tools/emacs/lisp/dired-x.el...
Compilation finished.
I don't understand why does it consumes around 100% cpu on the background since compilation already done on the previous session. Which makes intances that has 1 GiB Memory halts.
Is this a normal behavior? Is there any way to make this process without consuming high cpu?
Observation: When I try to use GccEmacs
for performance improvement in a free-tier Google Instance, which requires 1 CPUs and 1 GiB memory. Due to startup compilation gccemacs
frozes the complete instance.
-b feature/native-comp
is not what your linked EmacsWiki page says.-b feature/native-comp
// updated on my answer. Will it compile everytime when I start the emacs server? I thought it should start right away from the already compiled filesmaster
and from there toemacs-28
where it will be released. There is literally no development happening on the old branch.