This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Memoization [was: `undefine']


"Marisha Ray & Neil Jerram" <mpriz@dircon.co.uk> writes:

> 
> >A space finds a symbol's binding either by looking up the symbol in a
> >hash table (as for a local space), or by delegating the search to other
> >spaces.  This means that the full symbol lookup process is too
> >expensive to perform on each variable reference.  Thus, Guile uses
> >memoization and caching to avoid repeating the search for a given
> >variable's binding, unless the space's configuration has changed.
> 
> I know I should really go and read the code, but I don't understand the
> benefit of memoization.  Why is looking up a value in a GLOC so much quicker
> than looking it up in a value cell?

The GLOC is inserted in place of the original symbol, so the next time
through there's no need to do any environment lookups at all.

-- 
Greg

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]