Associative array

Imperatorn johan_forsberg_86 at hotmail.com
Sun Oct 15 06:56:25 UTC 2023


On Sunday, 15 October 2023 at 00:14:39 UTC, Jonathan M Davis 
wrote:
> On Friday, October 13, 2023 5:32:29 AM MDT Imperatorn via 
> Digitalmars-d wrote:
>> [...]
>
> My main concern here would be that we not add calls which 
> relate to how AAs are currently implemented but which may not 
> relate to how they're implemented in the future if/when we make 
> changes, and I'm inclined to think that anything to do with 
> buckets is an implementation detail, making reserving not 
> something that users should really be doing. It _might_ make 
> sense to have a general reserve function that says that you're 
> planning to insert X number of elements, allowing the AA to 
> pre-allocate some stuff based on that information, but I don't 
> know how much sense that really makes given that what that 
> would mean for a given AA implementation could differ quite a 
> bit.
>
> [...]

I think you're basically right. But what could be done is to 
instead of reserving n buckets like the other languages do, maybe 
we could (if gc is used in this example) make a calculated gc 
reserve.

But, I've taken a quick look at 3-4 other languages, and they 
basically reserve buckets.


More information about the Digitalmars-d mailing list