next up previous contents
Next: 5.11.9 Specialized Structure Slots Up: 5.11 Numbers Previous: 5.11.7 Floating Point Efficiency

5.11.8 Specialized Arrays

       

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 Lispgif 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 5.13. See section 5.10.3.


next up previous contents
Next: 5.11.9 Specialized Structure Slots Up: 5.11 Numbers Previous: 5.11.7 Floating Point Efficiency

Raymond Toy
Mon Jul 14 09:11:27 EDT 1997