hat-trie icon indicating copy to clipboard operation
hat-trie copied to clipboard

Value-less trie

Open b4hand opened this issue 11 years ago • 1 comments

It would be nice to be able to support a pure trie that has no additional value besides the key itself.

This change seems like it would be a bit invasive, and I'm not sure how to achieve it without inducing some code duplication, but I was curious if you had any strong objections to this feature?

b4hand avatar Jun 30 '14 20:06 b4hand

If you're keeping a set of many string, then there's clearly an advantage to a hat-trie version that saves 4-8 bytes per entry by not keeping a value. Since the goal is to create a highly optimized structure for strings, adding a set variant makes sense.

It would be a slightly messy, but I think it could be done by adding a flag to hattrie_t and ahtable_t that determines wether a value should be stored, adding a few conditions to ahtable_t and making a thin hattrie_set_... API.

dcjones avatar Jul 01 '14 01:07 dcjones