diff --git a/.clang-tidy b/.clang-tidy index f80e93bce8..9c21b52cb8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -4,6 +4,7 @@ Checks: [-*, performance-enum-size, performance-faster-string-find, performance-for-range-copy, + performance-inefficient-vector-operation, # Skipping these temporarily because they are very noisy -bugprone-narrowing-conversions, diff --git a/src/broker/Manager.cc b/src/broker/Manager.cc index 7b9d2af591..744e6578b0 100644 --- a/src/broker/Manager.cc +++ b/src/broker/Manager.cc @@ -678,6 +678,7 @@ void Manager::DoTerminate() { iosource_mgr->UnregisterFd(bstate->loggerQueue->FlareFd(), this); vector stores_to_close; + stores_to_close.reserve(data_stores.size()); for ( auto& x : data_stores ) stores_to_close.push_back(x.first); diff --git a/src/script_opt/Stmt.cc b/src/script_opt/Stmt.cc index ef5935b044..92f0b981d2 100644 --- a/src/script_opt/Stmt.cc +++ b/src/script_opt/Stmt.cc @@ -1056,6 +1056,8 @@ StmtPtr InitStmt::Duplicate() { // Need to duplicate the initializer list since later reductions // can modify it in place. std::vector new_inits; + new_inits.reserve(inits.size()); + for ( const auto& id : inits ) new_inits.push_back(id); diff --git a/src/zeek-setup.cc b/src/zeek-setup.cc index 7bf0fee8f5..8f8d88228a 100644 --- a/src/zeek-setup.cc +++ b/src/zeek-setup.cc @@ -942,6 +942,7 @@ SetupResult setup(int argc, char** argv, Options* zopts) { } std::vector all_signature_files; + all_signature_files.reserve(options.signature_files.size() + zeek::detail::sig_files.size()); // Append signature files given on the command line for ( const auto& sf : options.signature_files )