Skip to content

Commit

Permalink
Take fileNames by value in InputFileCatalog constructor
Browse files Browse the repository at this point in the history
The constructor makes a copy of the fileNames anyway. For the cases
where InputFileCatalog is constructed with temporary or moved
vector<string>, this change allows to avoid copying that vector.

The Sources tend to pass in directly a temporary vector<string> from
the ParameterSet, so there could be a visible reduction in memory
churn.
  • Loading branch information
makortel committed Dec 19, 2024
1 parent 1c73ff3 commit ae9d552
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion FWCore/Catalog/interface/InputFileCatalog.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace edm {

class InputFileCatalog {
public:
InputFileCatalog(std::vector<std::string> const& fileNames,
InputFileCatalog(std::vector<std::string> fileNames,
std::string const& override,
bool useLFNasPFNifLFNnotFound = false,
//switching between two catalog types
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Catalog/src/InputFileCatalog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

namespace edm {

InputFileCatalog::InputFileCatalog(std::vector<std::string> const& fileNames,
InputFileCatalog::InputFileCatalog(std::vector<std::string> fileNames,
std::string const& override,
bool useLFNasPFNifLFNnotFound,
edm::CatalogType catType)
: fileCatalogItems_(), overrideFileLocator_() {
init(fileNames, override, useLFNasPFNifLFNnotFound, catType);
init(std::move(fileNames), override, useLFNasPFNifLFNnotFound, catType);
}

InputFileCatalog::~InputFileCatalog() {}
Expand Down

0 comments on commit ae9d552

Please sign in to comment.