3.1 Introduction to the Compiler
3.1.3 Increasing the efficiency of compiled code
When you are using the production mode of the Compiler, you can increase the efficiency of compiled code by using any of the following methods:- declare information to the Compiler
- Adding declarations to your code allows the Compiler to produce more efficient code (see Section 3.2.8 on page 40).
- use type-specific operations
- Adding
type
declarations to your code eliminates run-time type checking and increases the speed of your code. If you declare the types of all the arguments and all the returned values of a Lisp expression, the Compiler can use type-specific arithmetic operators. This is especially useful for operations that use fixnum integers or hardware-supported floating-point numbers, as these operations are coded directly in machine language and are extremely fast (see Section 3.3 on page 49).
- Using in-line functions allows the Compiler to replace the procedure call to a function with the machine-language code for the body of that function. Calls to in-line functions are usually faster than normal procedure calls (see Section 3.2.6 on page 38).
- use constructs that the Compiler automatically optimizes
- The Compiler automatically optimizes certain constructs, such as macros and tail-recursive functions. You can improve the performance of your code by identifying and using these constructs (see Section 3.4 on page 57).
- Reducing the amount of dynamic storage allocated by a program reduces the number of garbage collections and can improve the performance of your code. One way to reduce the amount of dynamic storage is by using stack-allocated lists (see Section 3.2.10 on page 47).
- use optimization declarations
- Using
speed
optimization declarations increases the running speed of your code (see Section 3.2.8 on page 40).
The Advanced User's Guide - 9 SEP 1996 Generated with Harlequin WebMaker