[plt-scheme] cost of closure?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Mon Jun 4 18:58:44 EDT 2007

On 6/4/07, Jakub Piotr Cłapa <jpc at pld-linux.org> wrote:
> Matthew Flatt wrote:
> >    12 = 4 bytes * 3 fields or captured bindings
> >     4 = 4 bytes * 1 code (closure) or type (struct) pointer
> >     4 = 4 bytes * 1 MzScheme type tag and hash code
> >    12 = 12 bytes per cons cell (MzScheme level)
> >     8 = 4 bytes * 2 objects for GC's layer of size info
> >  ----
> >    40
>
> So the cons cell has the same memory footprint as a custom 2 field
> struct? And what about runtime access? How is struct field access
> implemented?

No -- structs have two words of tags. But struct field access is just
like field access via a ptr in C (add and de-ref).

Robby

Posted on the users mailing list.