Optimizing Closure Environment Representation
Report ID: TR-168-88Author: Appel, Andrew W. / Jim, Trevor
Date: 1988-07-00
Pages: 8
Download Formats: |PDF|
Abstract:
In lexically scoped languages with higher-order functions, any function may have free variables that are bound in the enclosing scope. The function can be compiled into machine code, but the values of the free variables will not be known until run time. Therefore a closure is used: a run-time data structure providing access to bindings of variables free in a given program fragment. Various schemes have been used to represent closures, from linked lists to flat vectors. Different representations will have different performance characteristics, notably in access time, creation time, storage space, and garbage collection. This paper describes some old representations and some new ones, and gives measurements of their efficiency.