[plt-scheme] cost of closure?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Thu May 31 18:32:50 EDT 2007

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.