Garbage Collection is Fast, but a Stack is Faster
James S. Miller, Guillermo Juan Rozas · DSpace@MIT (Massachusetts Institute of Technology) · 1994
Prompted by claims that garbage collection can outperform stack allocation when sufficientphysical memory is available, we present a careful analysis and set of cross-architecture measurements comparing these two approaches for the implementation of continuation (procedure call) frames. When the frames are allocated on a heap they require additional space, increase the amount of data transferred between memory and registers, and, on currentarchitectures, require more instructions. We find that stack allocation of continuation frames outperforms heap allocation in some cases by almost a factor of three. Thus, stacks remain an important implementation technique for procedure calls, even in the presence of an efficient, compacting garbage collector and large amounts of memory. keywords: compilers, garbage collection, storage management, performance evaluation. Copyright c fl Massachusetts Institute of Technology, 1993 This report describes research done at the Artificial Intelligence Laboratory of the Massachusetts Institute of Technology. Support for the laboratory's artificial intelligence researchisprovided in part bytheAdvanced Research Projects Agency of the Department of Defense under Office of Naval Researchcontract N00014-89-J-3202. 1