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

Working on a helper class that provides an immutable view of a table #113

Open
schombert opened this issue Mar 17, 2024 · 0 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@schombert
Copy link

I have found myself in a situation where I would like to serialize and deserialize one of your hash tables, and, ideally, I would like to be able to use the contents of the serialized hash table without having to reallocate memory (i.e. I want to be able to memory map the file and then just point to the data within it rather than copying out data into other containers). My design to accomplish this is the following: serialize the number of buckets + the buckets + the number of pairs in the vector + the vector of pairs. Then, when reading back the data, I load the arrays into a variant of the table class that just contains two spans (one for the buckets and one for the contents of the vector). This table variant exposes the same lookup operations but deletes any functions that would require altering the buckets / moving keys around / etc. Perhaps I could somehow recreate the buckets without serializing them, but I don't understand how the code works well enough to attempt that.

In any case, this isn't strictly a request, since it is something I am working on. Rather, I would like to know if you are interested the code for the feature (it is quite simple, however, so something that you could easily make for yourself). I guess I am really just sharing the idea in case you think it could be useful to other people.

@schombert schombert added the enhancement New feature or request label Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants