Next: , Up: Compiler Policy   [Contents][Index]


4.7.1 The Optimize Declaration

The optimize declaration recognizes six different qualities. The qualities are conceptually independent aspects of program performance. In reality, increasing one quality tends to have adverse effects on other qualities. The compiler compares the relative values of qualities when it needs to make a trade-off; i.e., if speed is greater than safety, then improve speed at the cost of safety.

The default for all qualities (except debug) is 1. Whenever qualities are equal, ties are broken according to a broad idea of what a good default environment is supposed to be. Generally this downplays speed, compile-speed and space in favor of safety and debug. Novice and casual users should stick to the default policy. Advanced users often want to improve speed and memory usage at the cost of safety and debuggability.

If the value for a quality is 0 or 3, then it may have a special interpretation. A value of 0 means “totally unimportant”, and a 3 means “ultimately important.” These extreme optimization values enable “heroic” compilation strategies that are not always desirable and sometimes self-defeating. Specifying more than one quality as 3 is not desirable, since it doesn’t tell the compiler which quality is most important.

These are the optimization qualities:

speed

How fast the program should is run. speed 3 enables some optimizations that hurt debuggability.

compilation-speed

How fast the compiler should run. Note that increasing this above safety weakens type checking.

space

How much space the compiled code should take up. Inline expansion is mostly inhibited when space is greater than speed. A value of 0 enables promiscuous inline expansion. Wide use of a 0 value is not recommended, as it may waste so much space that run time is slowed. See inline-expansion for a discussion of inline expansion.

[debug]

How debuggable the program should be. The quality is treated differently from the other qualities: each value indicates a particular level of debugger information; it is not compared with the other qualities. See debugger-policy for more details.

safety

How much error checking should be done. If speed, space or compilation-speed is more important than safety, then type checking is weakened (see weakened-type-checks). If safety if 0, then no run time error checking is done. In addition to suppressing type checks, 0 also suppresses argument count checking, unbound-symbol checking and array bounds checks.

extensions:inhibit-warnings

This is a CMUCL extension that determines how little (or how much) diagnostic output should be printed during compilation. This quality is compared to other qualities to determine whether to print style notes and warnings concerning those qualities. If speed is greater than inhibit-warnings, then notes about how to improve speed will be printed, etc. The default value is 1, so raising the value for any standard quality above its default enables notes for that quality. If inhibit-warnings is 3, then all notes and most non-serious warnings are inhibited. This is useful with declare to suppress warnings about unavoidable problems.


Next: The Optimize-Interface Declaration, Up: Compiler Policy   [Contents][Index]