Tessil/hat-trie

How to serialize/deserialize a map?

theconnectionist opened this issue · 4 comments

Thanks for the excellent implementation. I'm thinking of using the hat-trie in my project where I need to serialize the built map and later deserialize it. I'm working with tens of millions of strings, so would prefer to deserialize from disk than rebuild the map each time from raw data. What's a good way to serialize/deserialize to/from disk?

Hello,

Currently the only way to do it is to iterate over the hat-trie and to serialize each string one at the time. On deserialization, each string is read back and inserted through insert.

Using the internals of the structure it's possible to do it more efficiently and I wanted to add efficient serialze/deserialize functions since some time already.

I'll see if I can find some time to work on it in the next few weeks.

Thanks Tessil. I'm using that technique at the moment. When you implement your serialization, recommend using memory mapping.

Hi @theconnectionist

If you are interested I made a serialization branch that I'll probably merge in a couple of days. I still need to test it a bit more, but it can already give you an overview of the API and of the performances.

Thank you @Tessil. Much appreciated. I'll give it a try.