std.allocator ready for some abuse

Vladimir Panteleev vladimir at thecybershadow.net
Thu Oct 24 15:08:15 PDT 2013


On Thursday, 24 October 2013 at 21:44:43 UTC, Vladimir Panteleev 
wrote:
> On Thursday, 24 October 2013 at 19:53:56 UTC, Andrei 
> Alexandrescu wrote:
>> I know it's been a long wait. Hopefully it was worth it. The 
>> alpha release of untyped allocators is ready for tire-kicking 
>> and a test drive.

A nitpick:

FallbackAllocator!(InSituRegion!..., ...) can be faster by 
defining a specialized allocator as a Region, which is 
initialized with the slice of a static buffer, and once that is 
filled up, a new buffer. This avoids a conditional branch in 
FallbackAllocator (we'd be reusing the same branch that checks 
for a full buffer and returns null in Region). This combination 
will likely be used often so it might be worth optimizing this 
use case, but OTOH the FallbackAllocator conditional branch will 
likely be subject to good branch prediction, so at least on x86 
the gain might be minimal.


More information about the Digitalmars-d mailing list