Re:How does D improve on C++17?
by chrisseaton on Monday April 27, 2015 @05:05PM
(#9449066)
"Reuse rather than free and reallocate is a core practice whenever you feel the need for speed"
The problem with this conventional wisdom is that it defeats other optimisations. If you free, use, and deallocate a block of memory within a compilation unit, a compiler can transparently allocate it on the stack, or even keep it in registers
If you use a free-list the objects are always escaped, and the same optimisations can't be applied to them.
This is particularly true for small temporary objects, like an intermediate vector (as in coordinates) object.
The problem with this conventional wisdom is that it defeats other optimisations. If you free, use, and deallocate a block of memory within a compilation unit, a compiler can transparently allocate it on the stack, or even keep it in registers
If you use a free-list the objects are always escaped, and the same optimisations can't be applied to them.
This is particularly true for small temporary objects, like an intermediate vector (as in coordinates) object.