Avoid unnecessary copying and allocation in ExecutorBarrier::WhenDone()
.
Previously the code would make a copy of the `done_cb_` and update the status on a successful completion, neither of which is necessary, and both of which showed up in trace amounts in profiling. PiperOrigin-RevId: 179970701
This commit is contained in:
parent
46ee1521bf
commit
f10a598e34
@ -202,11 +202,12 @@ class ExecutorBarrier {
|
||||
// below.
|
||||
if (--pending_ == 0) {
|
||||
CHECK(done_cb_ != nullptr);
|
||||
done = done_cb_;
|
||||
done_cb_ = nullptr;
|
||||
std::swap(done, done_cb_);
|
||||
}
|
||||
|
||||
status = status_;
|
||||
if (!status_.ok()) {
|
||||
status = status_;
|
||||
}
|
||||
}
|
||||
|
||||
if (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user