diff options
| author | Martin Hořeňovský | 2023-01-28 13:00:24 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2023-01-28 13:00:30 +0100 |
| commit | 2403f5620e60b41d84e35a88bacbb8bd8e1d92a8 (patch) | |
| tree | b26a699a75f717f8dec9a8b86dbaf35556bd0956 /src/catch2/interfaces | |
| parent | d58491c85a534a9348634ac3e4eb384df22f4d71 (diff) | |
| download | catch3-2403f5620e60b41d84e35a88bacbb8bd8e1d92a8.tar.gz | |
Move SectionEndInfo into sectionEnded call in SECTION's destructor
When running `./tests/SelfTest -o /dev/null`, this saves 1272
allocations (437439 -> 437167). In general, this saves multiple
allocations per end of an entered `SECTION`, if the section name
was too long for SSO, because `RunContext::sectionEnded` can then
move the section's name further down the callstack.
Diffstat (limited to 'src/catch2/interfaces')
| -rw-r--r-- | src/catch2/interfaces/catch_interfaces_capture.hpp | 4 | ||||
| -rw-r--r-- | src/catch2/interfaces/catch_interfaces_reporter.cpp | 4 | ||||
| -rw-r--r-- | src/catch2/interfaces/catch_interfaces_reporter.hpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/catch2/interfaces/catch_interfaces_capture.hpp b/src/catch2/interfaces/catch_interfaces_capture.hpp index 0fe27e53..4c820724 100644 --- a/src/catch2/interfaces/catch_interfaces_capture.hpp +++ b/src/catch2/interfaces/catch_interfaces_capture.hpp @@ -46,8 +46,8 @@ namespace Catch { virtual bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) = 0; - virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0; - virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0; + virtual void sectionEnded( SectionEndInfo&& endInfo ) = 0; + virtual void sectionEndedEarly( SectionEndInfo&& endInfo ) = 0; virtual IGeneratorTracker* acquireGeneratorTracker( StringRef generatorName, diff --git a/src/catch2/interfaces/catch_interfaces_reporter.cpp b/src/catch2/interfaces/catch_interfaces_reporter.cpp index 0bcf66df..8c8bac54 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.cpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.cpp @@ -67,11 +67,11 @@ namespace Catch { } } - SectionStats::SectionStats( SectionInfo const& _sectionInfo, + SectionStats::SectionStats( SectionInfo&& _sectionInfo, Counts const& _assertions, double _durationInSeconds, bool _missingAssertions ) - : sectionInfo( _sectionInfo ), + : sectionInfo( CATCH_MOVE(_sectionInfo) ), assertions( _assertions ), durationInSeconds( _durationInSeconds ), missingAssertions( _missingAssertions ) diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp index da0112e3..8c122ced 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.hpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp @@ -78,7 +78,7 @@ namespace Catch { }; struct SectionStats { - SectionStats( SectionInfo const& _sectionInfo, + SectionStats( SectionInfo&& _sectionInfo, Counts const& _assertions, double _durationInSeconds, bool _missingAssertions ); |