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
phf memory-mapped files? #103
Comments
Yep, that definitely sounds reasonable! |
Do you think this would be a reasonable way to reduce compilation times for large maps (and help IDE by not showing it gigantic source file)? |
@idubrov It wouldn't reduce the time to compile the map the first time, but in theory you could cache that map and reuse it as long as the data remains unchanged. And it'd avoid the time to run the result through |
I would love to see it done as well! Currently I generate |
This proposal is interesting and novel but there's a lot of questions to answer. Namely, if we should just take a pointer to a memory map and interpret it as a
|
I'm by no means an expert on this, but my first instinct would be to design a protocol similar to Cap'n Proto, so packed and flattened in-place. Perhaps require a trait for key/value types that allows it to be packed and stored, somewhat like The "schema" in For versioning and type validation, it may be worth looking into how Cap'n Proto handles that, as well. Perhaps using the aforementioned trait to define some consistent type ids. As for preventing concurrent modifications... I'm not sure there is anything that can be done with that on the level of |
Theoretically, we could just define CapnProto versions of the |
Maybe I am totally wrong, but is the following an option? |
I'd love to have phf generate at compile-time a file that it can then memory-map at runtime and use as an efficient perfect hash. That would support programs that want to efficiently store and check a large set of words, but want to allow updating that set at runtime without recompiling the program.
The usage in the build.rs script would look similar, except that instead of writing out a .rs file, it would write out a data file. phf (or some crate depending on it) could then provide a function to open that file, which would memory-map the file and use it as a perfect hash.
Does this seem reasonable?
The text was updated successfully, but these errors were encountered: