Trie based backend

I am hesitant to use some of the Mops data structure packages as so many of them are in early phases of development and subject to bugs/errors/deprecation. Therefore, I would like to stick to only using Motoko Base data structures like RBTree, HashMap, and Trie.

I was wondering if I am putting myself at a major disadvantage by doing this. Preferably, to keep things simple I would like to use the Trie structure across all of my canisters. While in certain use cases other structures will outperform a Trie, I feel that it should still be efficient in almost all use cases. Does anyone see an issue with this design?

Yes.

Stableheapbtreemap has been in production use with canDB for over a year and Map v9 has been remarkably stable for over a year as well. I haven’t touched a base collection in years as their allocation performance tops out quickly and you soon hit O(n) allocation that take your entire round to execute and eventually even deterministic time slicing won’t help you.

You can see here in some of @ZhenyaUsenko initial benchmarks that Map was sometimes like 29x better at certain operations. Map v8.0.0, it's finally here

…and this was before the v9 improvements.

1 Like