avoid shared_ptr assignment in Version::Get()

Summary:
This is a 500ns operation while the whole Get() call takes only a few
micro!

Test Plan: ran db_bench, for a DB with 50M keys, QPS jumps from 5.2M/s to 7.2M/s

Reviewers: haobo, igor, dhruba

Reviewed By: haobo

CC: leveldb

Differential Revision: https://reviews.facebook.net/D17007
This commit is contained in:
Lei Jin 2014-03-19 10:54:32 -07:00
parent 71e6a34271
commit 6dc940d4c9

View file

@ -485,7 +485,7 @@ void Version::Get(const ReadOptions& options,
const Comparator* ucmp = vset_->icmp_.user_comparator();
auto merge_operator = db_options.merge_operator.get();
auto logger = db_options.info_log;
auto logger = db_options.info_log.get();
assert(status->ok() || status->IsMergeInProgress());
Saver saver;
@ -496,7 +496,7 @@ void Version::Get(const ReadOptions& options,
saver.value = value;
saver.merge_operator = merge_operator;
saver.merge_context = merge_context;
saver.logger = logger.get();
saver.logger = logger;
saver.didIO = false;
saver.statistics = db_options.statistics.get();
@ -618,7 +618,7 @@ void Version::Get(const ReadOptions& options,
// do a final merge of nullptr and operands;
if (merge_operator->FullMerge(user_key, nullptr,
saver.merge_context->GetOperands(),
value, logger.get())) {
value, logger)) {
*status = Status::OK();
} else {
RecordTick(db_options.statistics.get(), NUMBER_MERGE_FAILURES);