From 071fb0d77b59c4f8cb05e363a8bfd4973db5a9bc Mon Sep 17 00:00:00 2001 From: Siying Dong Date: Tue, 19 Nov 2013 16:37:34 -0800 Subject: [PATCH] Inline a couple of functions and put one save lazily clearing Summary: Machine several functions inline. Also, in DBIter.Seek() make value cleaning up lazily done. These are for the use case that Seek() are called lots of times but few return values. Test Plan: make all check Differential Revision: https://reviews.facebook.net/D14217 --- db/db_iter.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/db_iter.cc b/db/db_iter.cc index 4e3c52c6e..7a395db7a 100644 --- a/db/db_iter.cc +++ b/db/db_iter.cc @@ -426,13 +426,13 @@ void DBIter::FindPrevUserEntry() { } void DBIter::Seek(const Slice& target) { - direction_ = kForward; - ClearSavedValue(); saved_key_.clear(); AppendInternalKey( &saved_key_, ParsedInternalKey(target, sequence_, kValueTypeForSeek)); iter_->Seek(saved_key_); if (iter_->Valid()) { + direction_ = kForward; + ClearSavedValue(); FindNextUserEntry(false /*not skipping */); } else { valid_ = false; -- GitLab