Skip to content

bucket count #270

@gf777

Description

@gf777

Hello @greg7mdp
as always many thanks for this very useful tool.
I have a question about the internal bucket counts that relates to efficiency. It is my understanding that if the number of buckets is a prime number, even with bad hash function, one can get a very good/near perfect distribution in the buckets. This is especially useful when the inputs are unpredictable.
However, apparently it is impossible to set the number of buckets to achieve this very useful feature in unordered_map (and therefore I guess in parallel-hashmap) because we can only set the minimum number of buckets with rehash: https://cplusplus.com/reference/unordered_map/unordered_map/rehash/
Is there a reason for this? It sounds like have a defined number of buckets that allows this trick with prime numbers would allow for significant improvements in efficiency.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions