Garbage collection, and practical strategies to avoid allocation

Jacob Carlborg doob at me.com
Sat Jun 1 02:33:40 PDT 2013


On 2013-06-01 04:16, Adam D. Ruppe wrote:
> Some little things we could do is add overloads to some functions that
> return string to be able to take a buffer argument too.
>
> string to(T:string)(int a) { char[] buf = new char[](16); return
> assumeUnique(to(a, buffer));
>
> char[] to(int a, char[] buffer) { deposit it straight into buffer,
> return the slice into buffer that is actually used; }

This approach is used all over the place in Tango.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list