You may also build a trie using marisa-build command-line
utility (provided by underlying C++ library; it should be downloaded and
compiled separately) and then load the trie from the resulting file
using .load() method.

Memory mapped I/O

It is possible to use memory mapped file as data source:

>>> trie = marisa_trie.RecordTrie(fmt).mmap('my_record_trie.marisa')

This way the whole dictionary won’t be loaded to memory; memory
mapped I/O is an easy way to share dictionary data among processes.

Lengths of words were stored as values in datrie.BaseTrie
and marisa_trie.RecordTrie. RecordTrie compresses
similar values and the key compression is better so it uses
much less memory than datrie.BaseTrie.

marisa_trie.Trie provides auto-assigned IDs. It is not possible
to store arbitrary values in marisa_trie.Trie so it uses less
memory than RecordTrie.