Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What actually is native compilation? Anyone mind explaining?


Emacs lisp can be compiled into bytecode (*.elc files) for faster execution.

Native compilation takes bytecode and compiles (all while doing some smart things like type and value propagation) it into machine code utilising libgccjit.

This results in some very nice speed gains.

The author described the project in his blog here: https://akrl.sdf.org/gccemacs.html


From what I can tell from https://www.emacswiki.org/emacs/GccEmacs - enabling a JIT for Emacs Lisp


It's not a JIT compiler, really. Just one more step (a big one, admittedly) for the existing bytecode compiler.


Aot in a way right ?


Yes, some kind of lazy ahead-of-time compilation.

By default the native compiler kicks in as soon as Emacs finds a bytecompiled file without a machine code equivalent. The resulting machine code is cached then for future use so this only happens once per a single *.elc file.

At least this is what i remember from the last time I checked the code :-)


Compiling to machine code




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: