Next: , Up: Efficiency Notes   [Contents][Index]


5.13.1 Type Uncertainty

The main cause of inefficiency is the compiler’s lack of adequate information about the types of function argument and result values. Many important operations (such as arithmetic) have an inefficient general (generic) case, but have efficient implementations that can usually be used if there is sufficient argument type information.

Type efficiency notes are given when a value’s type is uncertain. There is an important distinction between values that are not known to be of a good type (uncertain) and values that are known not to be of a good type. Efficiency notes are given mainly for the first case (uncertain types.) If it is clear to the compiler that that there is not an efficient implementation for a particular function call, then an efficiency note will only be given if the extensions:inhibit-warnings optimization quality is 0 (see optimize-declaration.)

In other words, the default efficiency notes only suggest that you add declarations, not that you change the semantics of your program so that an efficient implementation will apply. For example, compilation of this form will not give an efficiency note:

(elt (the list l) i)

even though a vector access is more efficient than indexing a list.


Next: Efficiency Notes and Type Checking, Up: Efficiency Notes   [Contents][Index]