Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Framework/Core/include/Framework/HistogramSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@ struct AxisSpec {
// first entry is assumed to be the number of bins; in case of variable size binning it must be set to zero
AxisSpec(ConfigurableAxis binEdges_, std::optional<std::string> title_ = std::nullopt, std::optional<std::string> name_ = std::nullopt);

// Out of line too, and for the same reason: every registry.add() call site
// materialises AxisSpec temporaries, so the *destructor* is expanded there as
// well -- on both the normal and the exception-unwind path. Measured with
// -Rpass=inline on a 276-histogram init(): ~optional<string> inlined 2164
// times, ~vector<AxisSpec> 552, ~vector<double> 367, ~AxisSpec 279.
//
// Declaring a destructor suppresses the implicit move operations, so all five
// are declared here to keep AxisSpec movable. The moves are explicitly
// noexcept: an out-of-line defaulted function does NOT inherit the implicit
// exception specification, and without it vector<AxisSpec> reallocation would
// silently fall back to copying.
~AxisSpec();
AxisSpec(AxisSpec const&);
AxisSpec(AxisSpec&&) noexcept;
AxisSpec& operator=(AxisSpec const&);
AxisSpec& operator=(AxisSpec&&) noexcept;

[[nodiscard]] long getNbins() const;

/// Function to make the axis logarithmic
Expand All @@ -122,6 +139,10 @@ struct HistogramConfigSpec {
HistogramConfigSpec() = default;
HistogramConfigSpec(HistogramConfigSpec const& other) = default;
HistogramConfigSpec(HistogramConfigSpec&& other) = default;
// Out of line: inlined 552 times into a single 276-histogram init().
// The copy/move constructors above stay declared, so this does not suppress
// them.
~HistogramConfigSpec();

void addAxis(const AxisSpec& axis)
{
Expand Down
9 changes: 9 additions & 0 deletions Framework/Core/src/HistogramSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ HistogramConfigSpec::HistogramConfigSpec(HistType type_, std::vector<AxisSpec> a
{
}

// Out of line: see the comments on the declarations in HistogramSpec.h.
AxisSpec::~AxisSpec() = default;
AxisSpec::AxisSpec(AxisSpec const&) = default;
AxisSpec::AxisSpec(AxisSpec&&) noexcept = default;
AxisSpec& AxisSpec::operator=(AxisSpec const&) = default;
AxisSpec& AxisSpec::operator=(AxisSpec&&) noexcept = default;

HistogramConfigSpec::~HistogramConfigSpec() = default;

void AxisSpec::makeLogarithmic()
{
if (binEdges.size() > 2) {
Expand Down
Loading