[plt-scheme] cost of closure?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Thu May 31 19:08:23 EDT 2007

On 5/31/07, YC <yinso.chen at gmail.com> wrote:
> Am I inferring correctly that you are saying closure consumes a constant
> factor of memory over struct, but otherwise doesn't necessarily hold onto
> unnecessarily references from the stack?

Right.

> Any other way besides closure & struct to create opaque compound value
> objects?

The way we think of it: all compound values are structs at one level
or another. You just may or may not have access to the inspector to
see the fields. So ... no. :)

> Thanks,
> yinso
>
>
> On 5/31/07, Robby Findler <robby at cs.uchicago.edu> wrote:
> > The size of a closure is proportional to the number of free variables
> > in the function. A struct with an equivalent number of slots uses less
> > memory, however.
> >
> > Robby
> >
> > On 5/31/07, YC < yinso.chen at gmail.com> wrote:
> > >
> > > On 5/31/07, Carl Eastlund <cce at ccs.neu.edu> wrote:
> > > > > In principle, a closure is essentially a struct.  All that needs to
> be
> > > > > stored is a code pointer and references to any free variables.  How
> > > > > efficient this is in practice depends a lot on the particular
> > > > > implementation.  Are you asking in general, or about PLT Scheme
> > > > > specifically?
> > >
> > > I am specifically interested in PLT Scheme (general info is also of
> interest
> > > but secondary).
> > >
> > >  Does closure hold references to the stack?  I've heard that Scheme
> doesn't
> > > keep variables on the stack, but want to verify.
> > >
> > >  If closure is as efficient as a struct that's great - I am finding
> myself
> > > leaning toward closure because it can be created anonymously and ad hoc,
> but
> > > doing so with struct is a lot harder.
> > >
> > >  Thanks,
> > >  yinso
> > >
> > >
> > > _________________________________________________
> > >   For list-related administrative tasks:
> > >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> > >
> > >
> >
>
>


Posted on the users mailing list.