summaryrefslogtreecommitdiff
path: root/devdocs/elisp/byte-compilation.html
blob: 73c33544f5d6e13788af4d9840c7a6ab96b7e9ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 <h2 class="chapter">Byte Compilation</h2>    <p>Emacs Lisp has a <em>compiler</em> that translates functions written in Lisp into a special representation called <em>byte-code</em> that can be executed more efficiently. The compiler replaces Lisp function definitions with byte-code. When a byte-code function is called, its definition is evaluated by the <em>byte-code interpreter</em>. </p> <p>Because the byte-compiled code is evaluated by the byte-code interpreter, instead of being executed directly by the machine’s hardware (as true compiled code is), byte-code is completely transportable from machine to machine without recompilation. It is not, however, as fast as true compiled code. </p> <p>In general, any version of Emacs can run byte-compiled code produced by recent earlier versions of Emacs, but the reverse is not true. </p>  <p>If you do not want a Lisp file to be compiled, ever, put a file-local variable binding for <code>no-byte-compile</code> into it, like this: </p> <div class="example"> <pre class="example">;; -*-no-byte-compile: t; -*-
</pre>
</div> <table class="menu" border="0" cellspacing="0"> <tr>
<td align="left" valign="top">• <a href="speed-of-byte_002dcode" accesskey="1">Speed of Byte-Code</a>
</td>
<td> </td>
<td align="left" valign="top">An example of speedup from byte compilation. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="compilation-functions" accesskey="2">Compilation Functions</a>
</td>
<td> </td>
<td align="left" valign="top">Byte compilation functions. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="docs-and-compilation" accesskey="3">Docs and Compilation</a>
</td>
<td> </td>
<td align="left" valign="top">Dynamic loading of documentation strings. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="dynamic-loading" accesskey="4">Dynamic Loading</a>
</td>
<td> </td>
<td align="left" valign="top">Dynamic loading of individual functions. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="eval-during-compile" accesskey="5">Eval During Compile</a>
</td>
<td> </td>
<td align="left" valign="top">Code to be evaluated when you compile. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="compiler-errors" accesskey="6">Compiler Errors</a>
</td>
<td> </td>
<td align="left" valign="top">Handling compiler error messages. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="byte_002dcode-objects" accesskey="7">Byte-Code Objects</a>
</td>
<td> </td>
<td align="left" valign="top">The data type used for byte-compiled functions. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="disassembly" accesskey="8">Disassembly</a>
</td>
<td> </td>
<td align="left" valign="top">Disassembling byte-code; how to read byte-code. </td>
</tr> </table><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
    <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Byte-Compilation.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Byte-Compilation.html</a>
  </p>
</div>