-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
capacity
behavior does not align with its documentation
#311
Comments
I can sporadically trigger a reallocation in as few as 25 inserts (i.e., after ≈ 13% of the originally reported capacity—which is 192 on my machine—is added). |
Is it possible to calculate a lower bound like
|
iirc many hashmaps have a fill-factor for reallocating, which is basically the fraction of slots to be occupied before reallocating (unlike I am not well versed with |
I'm aware of what fill-factor is. The point of this issue is that the documentation is not correct, and the ideal fix would be to change the implementation such that it returns a lower bound on the number of items that can be inserted without causing a reallocation à la |
Either there is a bug in code, or the documentation needs to be changed for
capacity
. The documentation states (emphasis added):The following code illustrates a reallocation occurs before inserting more than
capacity
key-value pairs.[zack@laptop src]$ uname -a Linux laptop 6.10.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 12 Sep 2024 17:21:02 +0000 x86_64 GNU/Linux [zack@laptop src]$ cargo -V cargo 1.81.0 (2dbb1af80 2024-08-20)
Unsurprisingly, the same problem exists for
DashSet
.The text was updated successfully, but these errors were encountered: