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-structuresis an optional list of objects which should be copied first to maximize locality.
defstructstructures defined with the (:PURE T) option are moved into read-only storage, further reducinggccost. List and vector slots of pure structures are also moved into read-only storage.
environment-nameis gratuitous documentation for compacted version of the current global environment (as seen insb!c::*info-environment*.) Ifnilis supplied, then environment compaction is inhibited.This function is a no-op on platforms using the generational garbage collector (x86, x86-64, ppc).
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.