Associative array

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Sun Oct 15 09:06:30 UTC 2023


On Sunday, 15 October 2023 at 06:56:25 UTC, Imperatorn wrote:
>
> 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.

In java for example you can list initial map size in elements not 
buckets: 
https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#HashMap-int-

If bucket reservation is added, it should be heavily emphasized 
that method is implementation specific, and no guarantees that 
would be available in alternative implementations. I.e. it should 
not be part of public AA interface.

Best regards,
Alexandru.


More information about the Digitalmars-d mailing list