Mojo: Optimize Node::DestroyAllPortsWithPeer
Node::DestroyAllPortsWithPeer is called any time a connection is lost to a remote Node, allowing the local process to recursively back-propagate awareness of broken port cycles (and thus disconnected Mojo primitives). The current implementation of DestroyAllPortsWithPeer turns out to be O(n^2) *gasp* and the frequency with which this can be called has gone overlooked for some time. Eep. This CL has Node maintain a reverse mapping from peer NodeNode+PortName to the set of all local ports which reference that NodeName+PortName combo as their peer. This allows for a much more efficient implementation of DestroyAllPortsWithPeer, particularly in the recursive branches which typically only affect at most a single local port. Bug: 922650 Change-Id: Ic0baf822f8735cce5f59a7820a729b748a6875ec Reviewed-on: https://chromium-review.googlesource.com/c/1433134 Commit-Queue: Ken Rockot <rockot@google.com> Reviewed-by:Erik Chen <erikchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#625841}
Showing
This diff is collapsed.
Please register or sign in to comment