next up previous contents index
Next: Specialized Structure Slots Up: Numbers Previous: Floating Point Efficiency   Contents   Index


Specialized Arrays

specialized array types specialized specialized array

Common Lisp supports specialized array element types through the:element-type argument to make-array. When an array has a specialized element type, only elements of that type can be stored in the array. From this restriction comes two major efficiency advantages:

These are the specialized element types currently supported:

bit (unsigned-byte 2) (unsigned-byte 4) (unsigned-byte 8) (unsigned-byte 16) (unsigned-byte 32) base-character single-float double-float

change_begin
Some versions of CMU Common Lisp5.5 also support the following specialized element types:
(signed-byte 8) (signed-byte 16) (signed-byte 30) (signed-byte 32)

change_end
Although a simple-vector can hold any type of object, t should still be considered a specialized array type, since arrays with element type t are specialized to hold descriptors.

When using non-descriptor representations, it is particularly important to make sure that array accesses are open-coded, since in addition to the generic operation overhead, efficiency is lost when the array element is converted to a descriptor so that it can be passed to (or from) the generic access routine. You can detect inefficient array accesses by enabling efficiency notes, see section efficiency-notes. See section array-types.


next up previous contents index
Next: Specialized Structure Slots Up: Numbers Previous: Floating Point Efficiency   Contents   Index
Peter Van Eynde 2001-03-08