Skip to content

Commit

Permalink
db/version_set.cc: use !empty() instead of 'size() > 0'
Browse files Browse the repository at this point in the history
Use empty() since it should be prefered as it has, following
the standard, a constant time complexity regardless of the
containter type. The same is not guaranteed for size().

Fix for:
[db/version_set.cc:2250]: (performance) Possible inefficient
 checking for 'column_families_not_found' emptiness.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
  • Loading branch information
dalgaaf committed Sep 30, 2014
1 parent 8ce050b commit b8b7117
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion db/version_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2169,7 +2169,7 @@ Status VersionSet::Recover(

// there were some column families in the MANIFEST that weren't specified
// in the argument. This is OK in read_only mode
if (read_only == false && column_families_not_found.size() > 0) {
if (read_only == false && !column_families_not_found.empty()) {
std::string list_of_not_found;
for (const auto& cf : column_families_not_found) {
list_of_not_found += ", " + cf.second;
Expand Down

0 comments on commit b8b7117

Please sign in to comment.