3 Optimizing Lisp Programs

3.1 Introduction to the Compiler

The Compiler reads Lisp expressions and generates native machine code that runs faster than the interpretation of the original source code. Compiled code generally produces the same values and has the same side effects as the interpretation of the original source code. Compiled code, however, can behave obscurely when errors occur and can require recompilation if macros or constants are redefined.

The more information you give the Compiler, the more efficient your compiled code will be. This chapter explains how to increase the efficiency of source code by adding declarations and discusses various optimizations that are automatically performed by the Compiler. You should be familiar with the material presented in Chapter 6, "Compiling Lisp Programs" in The User's Guide, which describes how to compile Lisp functions and files.

The following constructs are described in this chapter. See the reference pages at the end of this chapter for complete syntactic descriptions of these functions and forms.

compile 
compile-file
compiled-function-p
compiler-options
declare
def-compiler-macro
defsubst
disable-stack-lists
disassemble
enable-stack-lists
eval-when
locally
proclaim
report-compiler-options
reset-compiler-options
*style-warnings*
the
uncompile
undef-compiler-macro
unproclaim
with-compiler-options
with-deferred-warnings

3.1.1 - Selecting compilation modes
3.1.2 - When to compile code
3.1.3 - Increasing the efficiency of compiled code
3.1.4 - Showing optimization reports

The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker