std.allocator ready for some abuse

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Oct 24 17:02:35 PDT 2013


On 10/24/13 3:08 PM, Vladimir Panteleev wrote:
> 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.

Yah, good idea. At some point I have no doubt that intensively-used 
allocators will be tuned a fair amount.

Andrei



More information about the Digitalmars-d mailing list