1

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.

enter image description here

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.

11
  • -b feature/native-comp is not what your linked EmacsWiki page says.
    – phils
    Commented Mar 10, 2022 at 12:21
  • "I don't understand why does it consumes around 100% cpu on the background since compilation already done on the previous session." -- look at the native compilation log buffer to see what it is doing (which will undoubtedly be compiling your config).
    – phils
    Commented Mar 10, 2022 at 12:22
  • @phils When I dig in in the page (akrl.sdf.org/gccemacs.html#orgf5ebdd1), they recommended -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 files
    – alper
    Commented Mar 10, 2022 at 15:30
  • That entry is dated "2021-02-26 Fri" which is more than a year ago. The feature was merged to master and from there to emacs-28 where it will be released. There is literally no development happening on the old branch.
    – phils
    Commented Mar 10, 2022 at 21:29
  • 1
    Yes. master is unstable; emacs-28 is close to a stable release.
    – phils
    Commented Mar 10, 2022 at 23:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.