Arena-Based Memory Management and Other Optimizations
Our memory-management toolbox is growing with every chapter. We now know how to overload memory allocation operators (Chapter 7) and how to put this skill to work in ways that solve a variety of concrete problems (Chapter 8 and Chapter 9 both give a few illustrative, real-world examples).
One important reason why one would want to take control of memory allocation mechanisms is performance. Now, it would be presumptuous (and plain wrong!) to state that it’s trivial to beat the implementation of these functions as provided by your library vendor, as these are good, often very good, for the average case. The key element of the previous phrase, of course, is “for the average case.” When one’s use case has specificities that are known of beforehand, it is sometimes possible to benefit from that information and carve an implementation that outperforms, maybe by a wide margin, anything that could have been...