Reserving capacity in associative arrays

sigod via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 14 21:29:23 PST 2016


On Monday, 15 February 2016 at 03:22:44 UTC, Jon D wrote:
> Is there a way to reserve capacity in associative arrays? In 
> some programs I've been writing I've been getting reasonable 
> performance up to about 10 million entries, but beyond that 
> performance is impacted considerably (say, 30 million or 50 
> million entries). GC stats (via the "--DRT-gcopt=profile:1" 
> option) indicate dramatic increases in gc time, which I'm 
> assuming comes from resizing the underlying hash table. I'm 
> guessing that by preallocating a large size the performance 
> degradation would not be quite so dramatic. The underlying 
> implementation of associative arrays appears to take an initial 
> number of buckets, and there's a private resize() method, but 
> it's not clear if there's a public way to use these.
>
> --Jon

Maybe try using this: http://code.dlang.org/packages/aammm


More information about the Digitalmars-d-learn mailing list