util/ldb_cmd.cc: prefer prefix ++operator for non-primitive types
Prefer prefix ++operator for non-primitive types like iterators for performance reasons. Prefix ++/-- operators avoid creating a temporary copy. Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
parent
af8c2b2d97
commit
4cc8643baf
@ -325,7 +325,7 @@ bool LDBCommand::ParseKeyValue(const string& line, string* key, string* value,
|
|||||||
bool LDBCommand::ValidateCmdLineOptions() {
|
bool LDBCommand::ValidateCmdLineOptions() {
|
||||||
|
|
||||||
for (map<string, string>::const_iterator itr = option_map_.begin();
|
for (map<string, string>::const_iterator itr = option_map_.begin();
|
||||||
itr != option_map_.end(); itr++) {
|
itr != option_map_.end(); ++itr) {
|
||||||
if (find(valid_cmd_line_options_.begin(),
|
if (find(valid_cmd_line_options_.begin(),
|
||||||
valid_cmd_line_options_.end(), itr->first) ==
|
valid_cmd_line_options_.end(), itr->first) ==
|
||||||
valid_cmd_line_options_.end()) {
|
valid_cmd_line_options_.end()) {
|
||||||
@ -335,7 +335,7 @@ bool LDBCommand::ValidateCmdLineOptions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (vector<string>::const_iterator itr = flags_.begin();
|
for (vector<string>::const_iterator itr = flags_.begin();
|
||||||
itr != flags_.end(); itr++) {
|
itr != flags_.end(); ++itr) {
|
||||||
if (find(valid_cmd_line_options_.begin(),
|
if (find(valid_cmd_line_options_.begin(),
|
||||||
valid_cmd_line_options_.end(), *itr) ==
|
valid_cmd_line_options_.end(), *itr) ==
|
||||||
valid_cmd_line_options_.end()) {
|
valid_cmd_line_options_.end()) {
|
||||||
@ -1538,7 +1538,7 @@ void BatchPutCommand::DoCommand() {
|
|||||||
WriteBatch batch;
|
WriteBatch batch;
|
||||||
|
|
||||||
for (vector<pair<string, string>>::const_iterator itr
|
for (vector<pair<string, string>>::const_iterator itr
|
||||||
= key_values_.begin(); itr != key_values_.end(); itr++) {
|
= key_values_.begin(); itr != key_values_.end(); ++itr) {
|
||||||
batch.Put(itr->first, itr->second);
|
batch.Put(itr->first, itr->second);
|
||||||
}
|
}
|
||||||
Status st = db_->Write(WriteOptions(), &batch);
|
Status st = db_->Write(WriteOptions(), &batch);
|
||||||
|
Loading…
Reference in New Issue
Block a user