From a8b8b11dc4f452fab29cb26989997eb740bfaea6 Mon Sep 17 00:00:00 2001 From: Siying Dong Date: Tue, 17 Dec 2013 14:58:42 -0800 Subject: [PATCH] Get() Does Not Reserve space for to_delete memtables Summary: It seems to be a decision tradeoff in current codes: we make a malloc for every Get() to reduce one malloc for a flush inside mutex. It takes about 5% of CPU time in readrandom tests. We might consider the tradeoff to be the other way around. Test Plan: make all check Reviewers: dhruba, haobo, igor Reviewed By: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D14697 --- db/db_impl.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index c06d2f5bc..6c57a986d 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -2597,7 +2597,6 @@ Status DBImpl::GetImpl(const ReadOptions& options, StopWatch sw(env_, options_.statistics.get(), DB_GET); SequenceNumber snapshot; std::vector to_delete; - to_delete.reserve(options_.max_write_buffer_number); mutex_.Lock(); if (options.snapshot != nullptr) { snapshot = reinterpret_cast(options.snapshot)->number_; @@ -2665,7 +2664,6 @@ std::vector DBImpl::MultiGet(const ReadOptions& options, StopWatch sw(env_, options_.statistics.get(), DB_MULTIGET); SequenceNumber snapshot; std::vector to_delete; - to_delete.reserve(options_.max_write_buffer_number); mutex_.Lock(); if (options.snapshot != nullptr) {