. navigate
Navigate
Minimizing Paging    Page 19 left arrow
x
right arrow Page 21    Minimizing Paging
Minimizing Paging








LISP Pointers
Volume I, Number 1
April-May 1987



Minimizing Paging
page 20



Previous Article               Restart This Article               Next Article






Prev Article               Start of This Article                Next Article



where many Common Lisp functions reference memory on the 3600. Knowledge of this behavior allows programmers to choose data types and structures that minimize memory references for a given application.
The function         references its argument(s)
aref always
arrayp never
cdr when the argument is not nil
eq never
eql when both arguments are extended numbers
equal under most circumstances
integerp when the argument is an extended number
keywordp when the argument is a symbol
length when the argument is not nil
list never (new memory is allocated)
numberp never
stringp when the argument is an array
symbol-plist always
symbolp never
1+ when the argument is an extended number


One technique for improving paging performance is to use a less general function that does not reference memory instead of a specific function that does reference memory. A common example is to use eql instead of equal when possible. A more subtle example is to use arrayp rather than stringp, when it is known that the object being tested cannot be a nonstring array. Similarly, symbolp can replace keywordp, when appropriate. (Note that the paging behavior of Common Lisp functions is determined more by the implementation than the language specification.)

Declarations can be used to improve performance in all implementations. One declaration that can reduce memory references on the Symbolics 3600 is the sys:array-register declaration. This declares arrays to be commonly referenced and caches array dimensions and other consistency information on the stack in "fast" memory, removing the need to reference the array header every time the array is accessed. Similarly, the sys:downward-function and sys:downward-funarg declarations can be used to specify that a lexical closure is only being passed downward. This allows the function to be allocated on the stack in "fast" memory, rather than on the heap.



Garbage Collection

Garbage collection is the process that automatically performs object deallocation (storage reclamation). Although garbage collection removes the burden of memory


Page Left left arrow         
x
right arrow Page Right
Vol. I, No. 1
Table of Contents




Home   Favorites   Computers   Map

IME logo Copyright © 2009, Mary S. Van Deusen