. navigate
Navigate
Minimizing Paging    Page 16 left arrow
x
right arrow Page 18    Minimizing Paging
XREF








LISP Pointers
Volume I, Number 1
April-May 1987



Minimizing Paging
page 17









Prev Article               Start of This Article                Next Article



property list must reference at least five discontiguous pages.1  Finally, because symbols and name strings cannot be expected to be in a useful order in memory, looking up a different symbo1's property is likely to touch five more pages. An application that depends on subsequent queries to the same database can significantly improve paging performance by using alternate data structures, such as hash tables or B* trees.

Common Lisp allows symbols to be manipulated in much the same way as strings. However, this practice adds a level of indirection and scatters memory references. Using the old, widely scattered strings that were created with the symbols can significantly decrease a program's locality of reference. When ephemeral garbage collection [Moon 84] is available, it is often more efficient to create new strings for short times on the heap, where memory references will be clustered together and the ephemeral strings can be efficiently reclaimed.

Symbols are used to store values of special variables. Whenever the value of such a variable is referenced, modified, bound or unbound, the symbol is referenced as well. Note that in a shallow-binding architecture2  such as the 3600, bound symbols are unbound at every process switch. This happens quite frequently, for example when servicing network processes. Thus, using special variables can adversely affect the working sets of all processes.

Another common use for symbols is as unique value identifiers. This usage is in fact quite efficient, since comparison of symbols using eq or eql does not reference memory.

In Summary:

  • Don't use symbols as strings.

  • Don't use symbols and property lists as string hash tables.

  • Avoid using property lists in conjunction with symbols

  • Minimize usage of special variables.

  • Avoid explicitly referencing symbols with functions such as symbol-value or fboundp.



*****************


1    The package hash table header (for consistency checks), the hash table elements, the symbol, the symbol's print-name string, and the symbol's property list. Note that some of these components, particularly the property list, might consume more than one page. The five pages referenced in the lookup are in addition to the pages occupied by the key string and the structure value returned.

2    ln a shallow binding architecture, when a variable is bound, its old value is stored on the stack for later restoration [Gabriel 85, pages 6-8].



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