marigold-dev / pollinate

A platform agnostic library for P2P communications using UDP and Bin_prot
22 stars 2 forks source link

Use maps instead of hashtables for pairing responses and requests #20

Open InfiniteSwerve opened 2 years ago

InfiniteSwerve commented 2 years ago

In order to match requests and responses, an index is used to identify them as a pair. A map should be used to store these data instead of a hashtable. See below.

Why [not use hashtables]? What do you want us to use instead?

Maps, Hashtbl's are mutable but they also have collision, which makes them quite tricky to analyze, especially in a critical environment such as a blockchain, so don't use them unless you really need that additional bit of performance

Originally posted in https://github.com/marigold-dev/deku/issues/432#issuecomment-1046873460