This is an automated email from the ASF dual-hosted git repository.
chenBright pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push:
new 1944c453 Avoid redundant Redis cluster command and reply copies (#3702)
1944c453 is described below
commit 1944c453b6d04af7d63043c4b0506c4b4eb1695f
Author: nkysg <[email protected]>
AuthorDate: Fri Nov 6 10:36:53 2026 +0800
Avoid redundant Redis cluster command and reply copies (#3702)
* Avoid redundant Redis cluster command and reply copies
* use emplace_back
---
src/brpc/redis_cluster.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/brpc/redis_cluster.cpp b/src/brpc/redis_cluster.cpp
index ebc0820d..a06cc597 100644
--- a/src/brpc/redis_cluster.cpp
+++ b/src/brpc/redis_cluster.cpp
@@ -342,7 +342,7 @@ bool RedisClusterChannel::ParseRequest(const RedisRequest&
request,
for (size_t i = 0; i < args.size(); ++i) {
cmd.args.push_back(args[i].as_string());
}
- commands->push_back(cmd);
+ commands->push_back(std::move(cmd));
}
return true;
}
@@ -476,12 +476,12 @@ bool RedisClusterChannel::ExecuteMGet(const
ParsedCommand& cmd,
if (!ExecuteSingleCommand(sub_args, nullptr, &sub_result, cntl)) {
return false;
}
- values.push_back(sub_result.encoded_reply);
+ values.emplace_back(sub_result.encoded_reply.movable());
}
AppendArrayHeader(encoded_reply, values.size());
for (size_t i = 0; i < values.size(); ++i) {
- encoded_reply->append(values[i]);
+ encoded_reply->append(values[i].movable());
}
return true;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]