BigInt -- a challenge for std.allocator

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Oct 30 12:20:03 PDT 2013


30-Oct-2013 22:02, Andrei Alexandrescu пишет:
> Well actually there are things that can be done at the allocator level
> to explicitly help reference counting:
> 1. The refcount could be an affix to the allocated block.

Yup. I seriously underappreciated this one.

>
> 2. Small refcounts can be kept together in a compact block a la HeapBlock.

That would entail some work to tie-up refcounts and bigint internal 
array, but it sounds interesting.

> 3. Or refcounts can be kept in a freelist.

Doubtful. That would amount to extra pointer stored per BigInt AND extra 
indirection to get at ref-count unless I'm missing the details completely.

> So refounting can be helped by an allocator built especially for it.
>

Agreed.
BTW AffixAllocator is quite a feat, I think I wanted it countless times 
while working on std.regex/std.uni. I expect massive code performance 
and clarity improvements when {core,std}.allocator comes in.

>
> Andrei
>


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list