mit-dci / utreexo

accumulator for bitcoin utxo set
MIT License
323 stars 60 forks source link

Map is implementation in STD C is a Tree #322

Open Shymaa-Arafat opened 3 years ago

Shymaa-Arafat commented 3 years ago

Just thought you Utreexo developers team should know that https://www.tutorialspoint.com/cpp_standard_library/map.htm https://codeforces.com/blog/entry/70947

To re-check if this is the best choice for your problem requirements

Sorry if I'm kind of pushing, but I think this is so important to know & think about the sooner the better before u go further in coding

In my understanding you didn't just kept a pointer or 2 when u could've removed them, u added another tree to storage which is either RBT or BST I'm not sure but in any case it's what existed before Utreexo & u originally made the forest to avoid it?

They say unordered map is stored as a hash table which could be better, but I don't know how better because any hash table implementation trade time with storage or not Optimized for space

Here's another confirmation an interview with the library designer https://m.slashdot.org/story/212481 (got it from here https://cs.stackexchange.com/questions/144045/how-c-and-alike-maps-are-actually-stored-in-memory/144067?noredirect=1#comment304155_144067)

the designer when asked about his regrets/2nd thoughts "For example, an in-memory B*-tree is a far better choice than a red-black tree for implementing an associative container"