Open
Description
I have some similar allocators:
- One gives out whole pages only. On Linux this is commonly 4KiB and on Apple silicon MacBook Pros this is commonly 16KiB.
- One which has one big static chunk. That's it, no subdivision (think no-std).
They are similar in that if I call HashMap::with_capacity_in
or other function with a capacity of c
:
- Knowing that
HashMap
can and will often round upc
to a bigger size. - Knowing that allocators in general are allowed to over-allocate and often will.
- Knowing that my allocators in particular are going to significantly over-allocate the number of bytes.
I would hope that HashMap
would attempt to use this extra allocation space, but it never inspects the returned size.
Are there any reservations about doing this? It will add cost on every allocation, but that's about the only reason I could think of. The benefit is that for some allocators, they will better utilize the allocation, and for some allocators this would be an extreme improvement. With that said, I am not a hash table expert in general, and certainly a noob in hash_brown
's internals, so there may be things I am unaware of.
Metadata
Metadata
Assignees
Labels
No labels