Skip to content

Commit

Permalink
Take reference to small_vector instead of moving
Browse files Browse the repository at this point in the history
Summary: If a small_vector is inline, moving is not that much better than copying.

Reviewed By: mingtaoy

Differential Revision: D44438831

fbshipit-source-id: 1b9569904bf6737a892fa854fbc657a3ff4e3277
  • Loading branch information
swolchok authored and facebook-github-bot committed Apr 13, 2023
1 parent 1859e38 commit 4b72116
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fizz/client/FizzClient-inl.h
Expand Up @@ -66,7 +66,7 @@ void FizzClient<ActionMoveVisitor, SM>::initiateKeyUpdate(

template <typename ActionMoveVisitor, typename SM>
void FizzClient<ActionMoveVisitor, SM>::startActions(Actions actions) {
this->processActions(std::move(actions));
this->processActions(actions);
}

template <typename ActionMoveVisitor, typename SM>
Expand Down
2 changes: 1 addition & 1 deletion fizz/protocol/FizzBase-inl.h
Expand Up @@ -117,7 +117,7 @@ bool FizzBase<Derived, ActionMoveVisitor, StateMachine>::actionProcessing()

template <typename Derived, typename ActionMoveVisitor, typename StateMachine>
void FizzBase<Derived, ActionMoveVisitor, StateMachine>::processActions(
typename StateMachine::CompletedActions actions) {
typename StateMachine::CompletedActions& actions) {
// This extra DestructorGuard is needed due to the gap between clearing
// actionGuard_ and potentially processing another action.
folly::DelayedDestruction::DestructorGuard dg(owner_);
Expand Down
2 changes: 1 addition & 1 deletion fizz/protocol/FizzBase.h
Expand Up @@ -144,7 +144,7 @@ class FizzBase {
uint16_t length) const;

protected:
void processActions(typename StateMachine::CompletedActions actions);
void processActions(typename StateMachine::CompletedActions& actions);

void addProcessingActions(typename StateMachine::ProcessingActions actions);

Expand Down
6 changes: 3 additions & 3 deletions fizz/server/FizzServer-inl.h
Expand Up @@ -80,17 +80,17 @@ void FizzServer<ActionMoveVisitor, SM>::startActions(AsyncActions actions) {
if (futureActions.isReady()) {
auto result = std::move(futureActions).getTry();
if (result.hasValue()) {
this->processActions(std::move(result).value());
this->processActions(result.value());
}
} else {
std::move(futureActions)
.via(this->state_.executor())
.thenValueInline(
[this](Actions&& a) { this->processActions(std::move(a)); });
[this](Actions&& a) { this->processActions(a); });
}
},
[this](Actions& immediateActions) {
this->processActions(std::move(immediateActions));
this->processActions(immediateActions);
});
}

Expand Down

0 comments on commit 4b72116

Please sign in to comment.