title: Which is faster: Stack allocation or Heap allocation
body: <p>This question may sound fairly elementary, but this is a debate I had with another developer I work with.</p>
  
  <p>I was taking care to stack allocate things where I could, instead of heap allocating them. He was talking to me and watching over my shoulder and commented that it wasn't necessary because they are the same performance wise.</p>
  
  <p>I was always under the impression that growing the stack was constant time, and heap allocation's performance depended on the current complexity of the heap for both allocation (finding a hole of the proper size) and de-allocating (collapsing holes to reduce fragmentation, as many standard library implementations take time to do this during deletes if I am not mistaken).</p>
  
  <p>This strikes me as something that would probably be very compiler dependent. For this project in particular I am using a <a href="http://en.wikipedia.org/wiki/Metrowerks" rel="noreferrer">Metrowerks</a> compiler for the <a href="http://en.wikipedia.org/wiki/PowerPC" rel="noreferrer">PPC</a> architecture. Insight on this combination would be most helpful, but in general, for GCC, and MSVC++, what is the case? Is heap allocation not as high performing as stack allocation? Is there no difference? Or are the differences so minute it becomes pointless micro-optimization.</p>