Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12_4_HLT_X] Improve memory usage in ParameterSet #45000

Merged
merged 12 commits into from
Jun 5, 2024
Merged
2 changes: 1 addition & 1 deletion DQMOffline/Trigger/src/EgHLTTrigTools.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ std::vector<int> trigTools::getMinNrObjsRequiredByFilter(const std::vector<std::
return retVal;
}
for (auto& psetIt : *psetRegistry) { //loop over every pset for every module ever run
const std::map<std::string, edm::Entry>& mapOfPara =
const auto& mapOfPara =
psetIt.second.tbl(); //contains the parameter name and value for all the parameters of the pset
const auto itToModLabel = mapOfPara.find(mag0);
if (itToModLabel != mapOfPara.end()) {
Expand Down
252 changes: 126 additions & 126 deletions FWCore/Framework/test/unit_test_outputs/test_deepCall_unscheduled.log

Large diffs are not rendered by default.

620 changes: 310 additions & 310 deletions FWCore/Integration/test/unit_test_outputs/testGetBy1.log

Large diffs are not rendered by default.

280 changes: 140 additions & 140 deletions FWCore/Integration/test/unit_test_outputs/testGetBy2.log

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ Sharing ESSource: class=EmptyESSource label='emptyESSourceZ'
Sharing ESSource: class=EmptyESSource label='emptyESSourceA'
Sharing ESSource: class=EmptyESSource label='emptyESSourceA1'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 1 and 0
Sharing ESProducer: class=ESTestProducerAZ label='esTestProducerAZ'
Sharing ESProducer: class=ESTestProducerA label='esTestProducerA'
Sharing ESProducer: class=ESTestProducerA label='esTestProducerA1'
Sharing ESProducer: class=ESTestProducerAZ label='esTestProducerAZ'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 2 and 0
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 2 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 3 and 0
Expand All @@ -49,10 +49,10 @@ EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess I
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 5 and 2
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 5 and 3
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 5 and 4
Sharing ESProducer: class=ESTestProducerAZ label='esTestProducerAZ'
Sharing ESProducer: class=ESTestProducerA label='esTestProducerA2'
Sharing ESProducer: class=ESTestProducerA label='esTestProducerA'
Sharing ESProducer: class=ESTestProducerA label='esTestProducerA1'
Sharing ESProducer: class=ESTestProducerA label='esTestProducerA2'
Sharing ESProducer: class=ESTestProducerAZ label='esTestProducerAZ'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 6 and 0
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 6 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 6 and 2
Expand Down Expand Up @@ -107,8 +107,8 @@ EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess I
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 12 and 0
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 12 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 12 and 2
Sharing ESProducer: class=ESTestProducerA label='esTestProducerA1'
Sharing ESProducer: class=ESTestProducerA label='esTestProducerA'
Sharing ESProducer: class=ESTestProducerA label='esTestProducerA1'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 12 and 3
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 12 and 4
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 12 and 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,66 +180,66 @@ Sharing ESSource: class=EmptyESSource label='emptyESSourceG'
Sharing ESSource: class=EmptyESSource label='emptyESSourceH'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 1 and 0
Sharing ESProducer: class=ESTestProducerF label='esTestProducerF'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH1'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
Sharing ESProducer: class=ESTestProducerD label='esTestProducerD'
Sharing ESProducer: class=ESTestProducerK label='esTestProducerK'
Sharing ESProducer: class=ESTestProducerI label='esTestProducerI'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH'
Sharing ESProducer: class=ESTestProducerJ label='esTestProducerJ'
Sharing ESProducer: class=ESTestProducerB label='esTestProducerB'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH'
Sharing ESProducer: class=ESTestProducerG label='esTestProducerG'
Sharing ESProducer: class=ESTestProducerD label='esTestProducerD'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH1'
Sharing ESProducer: class=ESTestProducerI label='esTestProducerI'
Sharing ESProducer: class=ESTestProducerC label='esTestProducerC'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
Sharing ESProducer: class=ESTestProducerB label='esTestProducerB'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 2 and 0
Sharing ESProducer: class=ESTestProducerF label='esTestProducerF'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
Sharing ESProducer: class=ESTestProducerG label='esTestProducerG'
Sharing ESProducer: class=ESTestProducerC label='esTestProducerC'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 2 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 3 and 0
Sharing ESProducer: class=ESTestProducerF label='esTestProducerF'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
Sharing ESProducer: class=ESTestProducerG label='esTestProducerG'
Sharing ESProducer: class=ESTestProducerC label='esTestProducerC'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 3 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 3 and 2
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 4 and 0
Sharing ESProducer: class=ESTestProducerF label='esTestProducerF'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
Sharing ESProducer: class=ESTestProducerG label='esTestProducerG'
Sharing ESProducer: class=ESTestProducerC label='esTestProducerC'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 4 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 4 and 2
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 4 and 3
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH1'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH'
Sharing ESProducer: class=ESTestProducerD label='esTestProducerD'
Sharing ESProducer: class=ESTestProducerB label='esTestProducerB'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH1'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 5 and 0
Sharing ESProducer: class=ESTestProducerF label='esTestProducerF'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
Sharing ESProducer: class=ESTestProducerG label='esTestProducerG'
Sharing ESProducer: class=ESTestProducerC label='esTestProducerC'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 5 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 5 and 2
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 5 and 3
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 5 and 4
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 6 and 0
Sharing ESProducer: class=ESTestProducerF label='esTestProducerF'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
Sharing ESProducer: class=ESTestProducerG label='esTestProducerG'
Sharing ESProducer: class=ESTestProducerC label='esTestProducerC'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 6 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 6 and 2
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 6 and 3
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 6 and 4
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 6 and 5
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 7 and 0
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH1'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH'
Sharing ESProducer: class=ESTestProducerG label='esTestProducerG'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH1'
Sharing ESProducer: class=ESTestProducerC label='esTestProducerC'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 7 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 7 and 2
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 7 and 3
Expand All @@ -248,11 +248,11 @@ EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess I
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 7 and 6
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 8 and 0
Sharing ESProducer: class=ESTestProducerF label='esTestProducerF'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH1'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH'
Sharing ESProducer: class=ESTestProducerG label='esTestProducerG'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH1'
Sharing ESProducer: class=ESTestProducerC label='esTestProducerC'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 8 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 8 and 2
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 8 and 3
Expand All @@ -262,10 +262,10 @@ EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess I
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 8 and 7
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 9 and 0
Sharing ESProducer: class=ESTestProducerF label='esTestProducerF'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH1'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH'
Sharing ESProducer: class=ESTestProducerH label='esTestProducerH1'
Sharing ESProducer: class=ESTestProducerC label='esTestProducerC'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 9 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 9 and 2
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 9 and 3
Expand All @@ -276,9 +276,9 @@ EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess I
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 9 and 8
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 10 and 0
Sharing ESProducer: class=ESTestProducerF label='esTestProducerF'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
Sharing ESProducer: class=ESTestProducerG label='esTestProducerG'
Sharing ESProducer: class=ESTestProducerC label='esTestProducerC'
Sharing ESProducer: class=ESTestProducerE label='esTestProducerE'
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 10 and 1
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 10 and 2
EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes 10 and 3
Expand Down
23 changes: 13 additions & 10 deletions FWCore/ParameterSet/interface/Entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ namespace edm {
std::vector<ParameterSet> getVPSet() const;

// coded string
Entry(std::string const& name, std::string const&);
Entry(std::string const& name, std::string const& type, std::string const& value, bool is_tracked);
Entry(std::string const& name, std::string const& type, std::vector<std::string> const& value, bool is_tracked);
Entry(std::string name, std::string_view);
Entry(std::string name, std::string_view type, std::string_view value, bool is_tracked);
Entry(std::string name, std::string_view type, std::vector<std::string> const& value, bool is_tracked);

~Entry() = default;
Entry(Entry const&) = default;
Expand All @@ -168,26 +168,29 @@ namespace edm {
void toString(std::string& result) const;
void toDigest(cms::Digest& digest) const;

size_t sizeOfString() const { return rep.size() + 4; }
size_t sizeOfString() const { return rep_.size() + 4; }

// access
bool isTracked() const { return tracked == '+'; }
bool isTracked() const { return tracked_ == '+'; }

char typeCode() const { return type; }
char typeCode() const { return type_; }

friend std::ostream& operator<<(std::ostream& ost, Entry const& entry);

//empty string view denotes failure to find bounds
static std::string_view bounds(std::string_view, std::size_t iEndHint);

private:
std::string name_;
std::string rep;
char type;
char tracked;
std::string rep_;
char type_;
char tracked_;

// verify class invariant
void validate() const;

// decode
bool fromString(std::string::const_iterator b, std::string::const_iterator e);
bool fromString(std::string_view::const_iterator b, std::string_view::const_iterator e);

// helpers to throw exceptions
void throwValueError(char const* expectedType) const;
Expand Down
6 changes: 4 additions & 2 deletions FWCore/ParameterSet/interface/ParameterDescriptionNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ namespace edm {
k_double = 'D',
k_vdouble = 'd',
k_bool = 'B',
k_string = 'S',
k_vstring = 's',
k_stringRaw = 'Z',
k_vstringRaw = 'z',
k_stringHex = 'S',
k_vstringHex = 's',
k_EventID = 'E',
k_VEventID = 'e',
k_LuminosityBlockID = 'M',
Expand Down
16 changes: 10 additions & 6 deletions FWCore/ParameterSet/interface/ParameterSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <map>
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#include <array>

Expand Down Expand Up @@ -53,7 +54,7 @@ namespace edm {
ParameterSet();

// construct from coded string.
explicit ParameterSet(std::string const& rep);
explicit ParameterSet(std::string_view rep);

~ParameterSet() = default;
ParameterSet(ParameterSet const& other) = default;
Expand Down Expand Up @@ -229,13 +230,13 @@ namespace edm {

std::vector<ParameterSet> popVParameterSet(std::string const& name);

typedef std::map<std::string, Entry> table;
typedef std::map<std::string, Entry, std::less<>> table;
table const& tbl() const { return tbl_; }

typedef std::map<std::string, ParameterSetEntry> psettable;
typedef std::map<std::string, ParameterSetEntry, std::less<>> psettable;
psettable const& psetTable() const { return psetTable_; }

typedef std::map<std::string, VParameterSetEntry> vpsettable;
typedef std::map<std::string, VParameterSetEntry, std::less<>> vpsettable;
vpsettable const& vpsetTable() const { return vpsetTable_; }

ParameterSet* getPSetForUpdate(std::string const& name, bool& isTracked);
Expand All @@ -253,12 +254,15 @@ namespace edm {
// return ID of empty parameter set without registering it.
static ParameterSetID emptyParameterSetID();

// returns empty if cannot find extent
static std::string_view extent(std::string_view);

private:
// construct from coded string and id.
ParameterSet(std::string const& rep, ParameterSetID const& id);
ParameterSet(std::string_view rep, ParameterSetID const& id);

// decode
bool fromString(std::string const&);
bool fromString(std::string_view);

void toStringImp(std::string&, bool useAll) const;

Expand Down
2 changes: 1 addition & 1 deletion FWCore/ParameterSet/interface/ParameterSetEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace edm {
ParameterSetEntry();
ParameterSetEntry(ParameterSet const& pset, bool isTracked);
ParameterSetEntry(ParameterSetID const& id, bool isTracked);
explicit ParameterSetEntry(std::string const& rep);
explicit ParameterSetEntry(std::string_view rep);

~ParameterSetEntry() = default;
ParameterSetEntry(ParameterSetEntry const&) = default;
Expand Down
2 changes: 1 addition & 1 deletion FWCore/ParameterSet/interface/VParameterSetEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace edm {
// default ctor for serialization
VParameterSetEntry();
VParameterSetEntry(std::vector<ParameterSet> const& vpset, bool isTracked);
VParameterSetEntry(std::string const& rep);
VParameterSetEntry(std::string_view rep);

~VParameterSetEntry() = default;
VParameterSetEntry(VParameterSetEntry const&) = default;
Expand Down
Loading