10.6 Optimizing your code

Careful use of the compiler optimize qualities described above may significantly improve the performance of your code. However it is not recommended that you simply experiment with the effect of adding declarations. It is more productive to work systematically:

  1. Use the Profiler, described in The Profiler, to analyse your application's performance and identify bottlenecks, then
  2. Consider whether re-writing of parts of your source code would improve efficiency at the bottlenecks, and
  3. Use :explain declarations to make the compiler generate optimization hints, and
  4. Consider adding suitable declarations as described in this chapter to improve efficiency at the bottlenecks.

The remainder of this section describes some specific ways to produce efficient compiled code with LispWorks.

10.6.1 Compiler optimization hints

10.6.2 Fast 32-bit arithmetic

10.6.3 Floating point optimization

10.6.4 Tail call optimization

10.6.5 Stack allocation of objects with dynamic extent

10.6.6 Inlining foreign slot access

LispWorks User Guide - 11 Mar 2008