Has AA a bad implementation?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Fri Feb 12 23:13:49 UTC 2021


On Friday, 12 February 2021 at 22:23:45 UTC, Steven Schveighoffer 
wrote:
> Note, I thought rehash would shrink the bucket array down, but 
> it looks like it ignores that when the AA is empty. That seems 
> like an omission.

Do we necessarily want that shrinkage by default?  If an AA has 
had a certain size in the past, and then is cleared, it seems 
likely that the typical use case is that it will fill up to a 
similar size again.

For comparison, does `rehash` shrink the bucket array when the AA 
is non-empty but much, much smaller than the bucket array?

I don't object to the possibility to shrink the bucket array 
where possible but it should probably require an explicit and 
unambiguous request.


More information about the Digitalmars-d mailing list