[reSIProcate] transport selector and loopback interfaces
Hi,
I've been profiling resiprocate with the epoll changes to identify and fix bottlenecks. The latest issue I've found is a bit of a corner case, but it is the one that I'm profiling against so it matters a lot to me for the moment. Specifically, I'm using resip/stack/test/testStack with:
- loopback interface
- explicitly routed with a Via header (route by Source, not by Dest).
- Many (10000) transports (different ports).
Within TransportSelector::findTransportBySource(), this hits the O(N) traversal thru all transports.
I'd like to re-order the search order to first search for exact match of of interface, and then only if that doesn't match to do the search thru all transports looking for loopbacks. Aside from solving my performance issue (because the exact search is STL indexed), this seems more correct: should first look for the exact transport requested, then expand the search.
The findTransportBySource code splits into the with-port and without-port cases. I'd make the same re-order change to both cases.
Anyone see any issues with this change? I believe Byron added the existing loopback handling.
Thanks,
Kennard