Optimizing closures in O(0) time
Optimizing closures in O(0) time
复制标题
在 O(0) 时间内优化闭包
DOI:
--
复制
发表时间:
2012
期刊:
影响因子:
--
通讯作者:
R. Dybvig
中科院分区:
文献类型:
--
作者:
Andrew W. Keep;Alex Hearn;R. Dybvig
The flat-closure model for the representation of first-class procedures is simple, safe-for-space, and efficient, allowing the values or locations of free variables to be accessed with a single memory indirect. It is a straightforward model for programmers to understand, allowing programmers to predict the worst-case behavior of their programs. This paper presents a set of optimizations that improve upon the flat-closure model along with an algorithm that implements them, and it shows that the optimizations together eliminate over 50% of run-time closure-creation and free-variable access overhead in practice, with insignificant compile-time overhead. The optimizations never add overhead and remain safe-for-space, thus preserving the benefits of the flat-closure model.