drwhut/decision

Use hash tables to store sockets and their connections.

Closed this issue · 1 comments

Instead of storing the socket's connections in an ordered list, where it would take O(log n) time to find, why not implement a hash table? That way, it would be O(1) time to find the socket and it's connections.

Eventually decided against this. Implementing a "generic" hash table is not type-safe, and generating the array of connections is quite expensive. Plus O(log n) is pretty good.