From d58491c85a534a9348634ac3e4eb384df22f4d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 28 Jan 2023 10:41:13 +0100 Subject: [PATCH] Move sectionInfo into sectionEndInfo when SECTION ends When running `./tests/SelfTest -o /dev/null`, this saves 468 allocations (438907 -> 437439). In general, this saves 1 allocation every time an entered `SECTION` ends and the section name was long enough to move out of the SSO buffer. --- src/catch2/internal/catch_section.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/catch2/internal/catch_section.cpp b/src/catch2/internal/catch_section.cpp index ca2e5d8c..63b4abd3 100644 --- a/src/catch2/internal/catch_section.cpp +++ b/src/catch2/internal/catch_section.cpp @@ -25,7 +25,7 @@ namespace Catch { Section::~Section() { if( m_sectionIncluded ) { - SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() }; + SectionEndInfo endInfo{ CATCH_MOVE(m_info), m_assertions, m_timer.getElapsedSeconds() }; if( uncaught_exceptions() ) getResultCapture().sectionEndedEarly( endInfo ); else