Phobos for Review: std.buffer.scopebuffer

Jakob Ovrum jakobovrum at gmail.com
Fri Feb 7 03:05:07 PST 2014


On Friday, 7 February 2014 at 08:24:39 UTC, Walter Bright wrote:
> https://github.com/D-Programming-Language/phobos/pull/1911
>
> This adds a package std.buffer, and the first entry in that 
> package, std.buffer.scopebuffer.
>
> ScopeBuffer is an OutputRange that sits on the stack, and 
> overflows to malloc/free. It's designed to help in eliminating 
> gc allocation by lower level functions that return buffers, 
> such as std.path.buildPath(). With some judicious user tuning 
> of the initial stack size, it can virtually eliminate storage 
> allocation.
>
> Using it is @system, but the user of ScopeBuffer can be 
> @trusted.
>
> An output range like this is a precursor to eliminating the 
> excessive gc use by functions such as buildPath().

Wasn't there a simple composed Allocator from std.allocator that 
did exactly this? Composing InSituAllocator with Mallocator 
through FallbackAllocator or something.


More information about the Digitalmars-d mailing list