Previous: Stale Extensions, Up: Beyond the ANSI Standard
The sb-ext:purify
function causes SBCL first to collect all
garbage, then to mark all uncollected objects as permanent, never again
attempting to collect them as garbage. This can cause a large increase
in efficiency when using a primitive garbage collector, or a more
moderate increase in efficiency when using a more sophisticated garbage
collector which is well suited to the program's memory usage pattern. It
also allows permanent code to be frozen at fixed addresses, a
precondition for using copy-on-write to share code between multiple Lisp
processes. This is less important with modern generational garbage
collectors, but not all SBCL platforms use such a garbage collector.
This function optimizes garbage collection by moving all currently live objects into non-collected storage.
root-structures
is an optional list of objects which should be copied first to maximize locality.
defstruct
structures defined with the (:PURE T) option are moved into read-only storage, further reducinggc
cost. List and vector slots of pure structures are also moved into read-only storage.
environment-name
is gratuitous documentation for compacted version of the current global environment (as seen insb
!c::*info-environment*
.) Ifnil
is supplied, then environment compaction is inhibited.
The sb-ext:truly-the
special form declares the type of the
result of the operations, producing its argument; the declaration is
not checked. In short: don't use it.
The sb-ext:freeze-type
declaration declares that a
type will never change, which can make type testing
(typep
, etc.) more efficient for structure types.
The sb-ext:constant-function
declaration specifies
that a function will always return the same value for the same
arguments, which may allow the compiler to optimize calls
to it. This is appropriate for functions like sqrt
, but
is not appropriate for functions like aref
,
which can change their return values when the underlying data are
changed.