News for hackers. Stuff that matters.
Re:Stack, Heap, Pool by Matheus28 on Tuesday September 15, 2015 @07:30PM (#10223772)
To be honest, I'd consider the entire benchmark void.

It really depends on how heap allocation is implemented, so it's hard to compare. By using memory pools, you can allocate a huge block of memory at once from the OS (a small initial cost), and lazily initialize the values. Which brings you: 1. Cache locality. 2. A lot less fragmentation.

I'd rank it as:

1. Stack allocation (essentially free)

2. Memory pool (a small hit every once in a while)

3. Heap allocation (significant overhead compared to the other ones)

There are no comments on this comment yet.