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

Examples of hashset. #92

Closed
amosbird opened this issue Dec 5, 2017 · 4 comments
Closed

Examples of hashset. #92

amosbird opened this issue Dec 5, 2017 · 4 comments

Comments

@amosbird
Copy link

amosbird commented Dec 5, 2017

Is there an example of libcuckoo hashset? Or should I just use cuckoohash_map<int, bool> Table;? Regards.

@dnbaker
Copy link

dnbaker commented Dec 5, 2017

You could save space by defining an empty struct and using it instead of bool. For example:

struct empty {};
cuckoohash_map<int, empty> Table;

@amosbird
Copy link
Author

amosbird commented Dec 6, 2017

Hmm, it takes much more memory than std::unordered_map (60GB) and std::map (80GB) . It gets oom killed after claiming 120GB memory.

@manugoyal
Copy link
Contributor

Hey! Sorry for the late reply.

Note that due to the design of the table, it will double in capacity every time it needs to do a resize. So it's possible that if your table is filled to capacity at 60G, then another insert would trigger an expansion of the table to capacity 120G. Unfortunately, there's not much we have in the works right now about providing alternative resize factors instead of 2 (see #7), though in the future this may be possible.

One thing I'm unclear about though is the number of elements actually present in your table. If your table type is a mapping from int to bool (or whatever value type), shouldn't there only be 2^32 possible key values, which should limit the size of your key-memory to 2^32 * 2^2 ~ 16G? If you could post a code snippet illustrating the table running out of memory that'd be super useful.

@manugoyal
Copy link
Contributor

Closing due to inactivity. Please feel free to reopen if you have more questions!

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

3 participants