[plt-scheme] cost of closure?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu May 31 19:36:12 EDT 2007

At Thu, 31 May 2007 16:31:28 -0700, YC wrote:
> While it's unclear for me what model PLT Scheme uses for structs - Robby
> alluded to that closures is only a constant factor over struct from memory
> consumption.

I think that constant factor should be between 0 and 1 pointer,
depending on whether the closure refers to top-level bindings or module
top-level bindings (other than things that are built into MzScheme, in
which case the reference is inlined instead of kept in the closure).

Otherwise, a closure has a pointer to its code, and a struct has a
pointer to it's type descriptor, so those balance; each field and
captured bindings take the same amount of space.

Matthew



Posted on the users mailing list.