Fast GC allocation of many small objects

Rubn where at is.this
Sat Mar 31 19:31:37 UTC 2018


On Friday, 30 March 2018 at 20:46:43 UTC, Per Nordlöw wrote:
> On Friday, 30 March 2018 at 20:38:35 UTC, rikki cattermole 
> wrote:
>> Use a custom allocator (that could be backed by the GC) using 
>> std.experimental.allocators :)
>
> https://dlang.org/phobos/std_experimental_allocator.html
>
> is massive.
>
> I guess I should allocate my nodes using
>
>     auto node = theAllocator.make!StrNode("alpha");
>
> Could someone please give a working example of a GC-backed 
> `theAllocator` suitable for my allocation pattern?

Be willing to change your code, the allocator can change at any 
point. What you implement today may not work tomorrow, what you 
fix to work for tomorrow may not end up working the next day (in 
terms of releases). That really should be something that is 
mentioned when you suggest using an experimential feature, 
there's no guarantees at all. It might not even get put into 
phobos. If your project is going to be used over the course of a 
year or more than maybe you shouldn't use it.


More information about the Digitalmars-d-learn mailing list