Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve time complexity of removal of callback handle. (#11751)
Improve the time complexity of removal of a callback handle from O(N) to O(1) by storing a list iterator to itself inside the callback_holder. Currently, when a callback handle is removed from the list, the pointer of the handle is used for linear search to locate the callback holder and delete it. Since list.erase() cost constant time if we provide the iterator, and list iterator don't get invalidated in other list operations. We can store the iterator inside the callback holder when we initialize it and use it for constant time removal. Risk Level: Low Testing: Pass all test in /test repo. Fixes #11665 Signed-off-by: chaoqinli <chaoqinli@google.com>
- Loading branch information