toString refactor in druntime
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Sat Nov 1 00:01:57 PDT 2014
On 10/30/2014 8:30 AM, Steven Schveighoffer wrote:
> This is a typical mechanism that Tango used -- pass in a ref to a dynamic array
> referencing a stack buffer. If it needed to grow, just update the length, and it
> moves to the heap. In most cases, the stack buffer is enough. But the idea is to
> try and minimize the GC allocations, which are performance killers on the
> current platforms.
We keep solving the same problem over and over. std.internal.scopebuffer does
this handily. It's what it was designed for - it works, it's fast, and it
virtually eliminates the need for heap allocations. Best of all, it's an Output
Range, meaning it fits in with the range design of Phobos.
More information about the Digitalmars-d
mailing list