[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Q: memoize?

From: Tom Lord
Subject: Re: [Gnu-arch-users] Q: memoize?
Date: Tue, 13 Apr 2004 13:26:42 -0700 (PDT)

    > From: Matthew Dempsky <address@hidden>

    > "Parker, Ron" <address@hidden> writes:

    > > I've seen the term memoize popup a few times on the list.  Is there a 
    > > explanation of this somewhere?

    > If it's meant in the same regards as used in SICP, memoize basically
    > just means to cache the result of a procedure.

Not quite.

Key thing: cached results can be discarded and recomputed as needed.
Memoized results are never discarded.

You can think of a memo as a special-case of a cache.  Every cache has
a policy for discarding recorded results --- a memo is a cache in
which the policy for discarding recorded results is "do not do that."

As one example, if you want an infinite constant array of random
values, you must use a memo (because you can not recompute a truly
random value).

As another example, if you want to keep some small segments of memory
being accessed by your (arbitrary) program in fast memory, "closer" to
the CPU than the main store, you must use a cache.  (Physics won't let
you make that fast memory as large as your main store, or your main
store as big as your swap area, or your swap area as big as the
observable universe.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]