| | |
Summary: J. Functional Programming 1 (1): 1--000, January 1993 c
# 1993 Cambridge University Press 1
An Empirical and Analytic Study of
Stack vs. Heap Cost
for Languages with Closures
ANDREW W. APPEL
Dept. of Computer Science, Princeton University, Princeton NJ 085442087, U.S.A. 1
ZHONG SHAO
Dept. of Computer Science, Yale University, New Haven CT 065208285, U.S.A. 2
Abstract
We present a comprehensive analysis of all the components of creation, access, and disposal
of heapallocated and stackallocated activation records. Among our results are:
. Although stack frames are known to have a better cache readmiss rate than heap
frames, our simple analytical model (backed up by simulation results) shows that the
di#erence is too trivial to matter.
. The cache writemiss rate of heap frames is very high; we show that a variety of
misshandling strategies (exemplified by specific modern machines) can give good per
formance, but not all can.
. Stacks restrict the flexibility of closure representations (for higherorder functions) in
important (and costly) ways.
|