mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
chore: improve performance of mget operation (#2212)
Specifically, allocate only a single blob when returning multiple entries from a shard. In addition, refactor and unify MGetResponse between string family code and ReplyBuilder code. Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
dafdb9f4cf
commit
7d53d196aa
11 changed files with 194 additions and 120 deletions
|
@ -282,7 +282,7 @@ class InterpreterReplier : public RedisReplyBuilder {
|
|||
void SendStored() final;
|
||||
|
||||
void SendSimpleString(std::string_view str) final;
|
||||
void SendMGetResponse(absl::Span<const OptResp>) final;
|
||||
void SendMGetResponse(MGetResponse resp) final;
|
||||
void SendSimpleStrArr(StrSpan arr) final;
|
||||
void SendNullArray() final;
|
||||
|
||||
|
@ -389,13 +389,13 @@ void InterpreterReplier::SendSimpleString(string_view str) {
|
|||
PostItem();
|
||||
}
|
||||
|
||||
void InterpreterReplier::SendMGetResponse(absl::Span<const OptResp> arr) {
|
||||
void InterpreterReplier::SendMGetResponse(MGetResponse resp) {
|
||||
DCHECK(array_len_.empty());
|
||||
|
||||
explr_->OnArrayStart(arr.size());
|
||||
for (uint32_t i = 0; i < arr.size(); ++i) {
|
||||
if (arr[i].has_value()) {
|
||||
explr_->OnString(arr[i]->value);
|
||||
explr_->OnArrayStart(resp.resp_arr.size());
|
||||
for (uint32_t i = 0; i < resp.resp_arr.size(); ++i) {
|
||||
if (resp.resp_arr[i].has_value()) {
|
||||
explr_->OnString(resp.resp_arr[i]->value);
|
||||
} else {
|
||||
explr_->OnNil();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue