PlainTableBuilder::Add() to use local char array instead of reused std::string as tmp buffer

Summary: Our profile shows that in one of the applications, 5% of the CPU costs of PlainTableBuilder::Add() are spent on std::string stacks. By this simple change, we avoid this global reusable string. Also, we avoid another call of file appending, which probably gives another 2%.

Test Plan: make all check

Reviewers: haobo, ljin

Reviewed By: haobo

CC: igor, yhchiang, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D17601
This commit is contained in:
sdong
2014-04-09 09:44:23 -07:00
parent b947fdc89d
commit e9ed28f9c8
2 changed files with 20 additions and 14 deletions

View File

@@ -69,9 +69,6 @@ private:
const size_t user_key_len_;
bool closed_ = false; // Either Finish() or Abandon() has been called.
std::string key_size_str_;
std::string value_size_str_;
bool IsFixedLength() const {
return user_key_len_ > 0;
}