Skip to content
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

Constructor can start selecting the bucketlist size at 2 instead of 1 #3

Open
Illation opened this issue Jan 25, 2020 · 1 comment
Open
Assignees

Comments

@Illation
Copy link

Assuming someone constructed a hash map with a capcity of 0 or 1 elements, and proceeded to add an element, the map would immediately rehash. Since we do not start with a completely empty bucket list anyway, we may as well start at 2. This would also save an iteration of the while loop.

@rigtorp rigtorp self-assigned this Feb 7, 2020
@rigtorp
Copy link
Owner

rigtorp commented Feb 7, 2020

Right, it would make sense to either start with not allocating the item storage and/or to start with a minimum of 8 or something reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants