Skip to content

Commit

Permalink
GetContext::SaveValue: case kTypeValue: improve
Browse files Browse the repository at this point in the history
reduced 2 branch and 1 assign `Slice value_to_use = value;`

This change improving performance a little
  • Loading branch information
rockeet committed May 2, 2023
1 parent 08297ee commit 4e5223f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions table/get_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,36 @@ bool GetContext::SaveValue(const ParsedInternalKey& parsed_key,
}
switch (type) {
case kTypeValue:
if (LIKELY(kNotFound == state_)) {
state_ = kFound;
if (LIKELY(do_merge_)) {
if (LIKELY(pinnable_val_ != nullptr)) {
if (LIKELY(value_pinner != nullptr)) {
pinnable_val_->PinSlice(value, value_pinner);
} else {
TEST_SYNC_POINT_CALLBACK("GetContext::SaveValue::PinSelf", this);
pinnable_val_->PinSelf(value);
}
#if defined(TOPLINGDB_WITH_WIDE_COLUMNS)
} else if (columns_ != nullptr) {
columns_->SetPlainValue(value, value_pinner);
#endif
}
}
else {
push_operand(value, value_pinner);
}
}
else {
assert(state_ == kMerge);
state_ = kFound;
if (LIKELY(do_merge_)) {
Merge(&value);
} else {
push_operand(value, value_pinner);
}
}
return false;
case kTypeBlobIndex:
case kTypeWideColumnEntity:
assert(state_ == kNotFound || state_ == kMerge);
Expand Down

0 comments on commit 4e5223f

Please sign in to comment.