Closed dralley closed 1 year ago
Update, partially tempering my own expectations:
One issue is that each node stores a full copy of the key - that has already been noted previously in other issues.
But one reason which is not really an issue is that standard radix tries are not really optimized for compactness and it's not entirely realistic to expect memory savings from a standard radix trie, because each node has to hold N pointers even if few of them are used. So to actually save memory, realistically it wouldn't be likely without an adaptive radix trie.
I want to use
radix_trie
to improve the memory efficiency of storing a large number of Unix file paths. Here's a sample of some of the input.This ought to be a near-ideal case for a Radix Trie because each path is near certain to share a prefix (a fairly long prefix, usually) with other paths. But that's not what I see when I run an experiment -- the Radix Trie requires 4x more memory to store the strings than a normal Vec. 3.73 gigabytes vs 925 megabytes.
Experiment code here: https://github.com/dralley/radix_trie_test