4 ms·
What actually is native compilation? Anyone mind explaining?
by nanna 5y ago
What actually is native compilation? Anyone mind explaining?
- ajdlinux 5y agoFrom what I can tell from https://www.emacswiki.org/emacs/GccEmacs https://www.emacswiki.org/emacs/GccEmacs - enabling a JIT for Emacs Lisp
- vkazanov 5y agoIt's not a JIT compiler, really. Just one more step (a big one, admittedly) for the existing bytecode compiler.
- agumonkey 5y agoAot in a way right ?
- vkazanov 5y agoYes, 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 :-)
- kragen 5y agoCompiling to machine code
- vkazanov 5y agoEmacs 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 https://akrl.sdf.org/gccemacs.html