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

Allocate empty group on heap only for std::allocator #254

Merged
merged 2 commits into from
Oct 19, 2024
Merged

Conversation

greg7mdp
Copy link
Owner

Otherwise leave ctrl_ as a nullptr.

@greg7mdp greg7mdp changed the title llocate empty group on heap only for std::allocator Allocate empty group on heap only for std::allocator Oct 19, 2024
@AgostonSzepessy
Copy link

Thanks for implementing this! Do you know if it would result in a perf regression if we didn't have ctrl_? The other thing we could do is user opt-in to store the ctrl_ on the raw_hash_set if there's a big perf gap.

@greg7mdp
Copy link
Owner Author

Thanks for implementing this! Do you know if it would result in a perf regression if we didn't have ctrl_? The other thing we could do is user opt-in to store the ctrl_ on the raw_hash_set if there's a big perf gap.

Regarding the perf regression, I very much doubt you could see any difference in real world use. This is why I prefer optimizing for correctness and overall good behavior (for example with poor hash functions) rather than for micro benchmarks.

I don't think storing the ctrl_ on the raw_hash_set is a good idea. First it probably would make no difference, and also it would do an allocation and use memory for empty hash maps, which I think is a bigger issue.

@greg7mdp
Copy link
Owner Author

Thanks again for bringing up this issue @AgostonSzepessy !

@greg7mdp greg7mdp merged commit 4817a6d into master Oct 19, 2024
20 checks passed
@greg7mdp greg7mdp deleted the emptygroup branch October 19, 2024 22:43
@AgostonSzepessy
Copy link

Thank you for fixing it so quickly!

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

Successfully merging this pull request may close these issues.

2 participants