Thanks to Cppers on reddit here.
Currently the Looper use std::map<int, std::unique_ptr<Connection>> to keep track of which connection's lifecycle is under its monitoring.
/**
* This Looper acts as the executor on a single thread
* adopt the philosophy of 'one looper per thread'
* */
class Looper {
public:
...
private:
...
std::map<int, std::unique_ptr<Connection>> connections_;
...
};
However, since we don't required the ordered property provided by std::map, a better performance could be achieved by using std::unordered_map. Typically given the fact that currently any access to this connections_ variable requires mutex for synchronization.
I plan to implement this feature shortly.
Yukun
Feb 07
Thanks to Cppers on reddit here.
Currently the
Looperusestd::map<int, std::unique_ptr<Connection>>to keep track of which connection's lifecycle is under its monitoring.However, since we don't required the ordered property provided by
std::map, a better performance could be achieved by usingstd::unordered_map. Typically given the fact that currently any access to thisconnections_variable requiresmutexfor synchronization.I plan to implement this feature shortly.
Yukun
Feb 07