forked from catchorg/Catch2
Clear unscoped messages lazily
This improves the fast path performance for successful assertions by about 7%, at the cost of potentially keeping around the message allocation longer.
This commit is contained in:
@@ -296,6 +296,10 @@ namespace Catch {
|
||||
}
|
||||
|
||||
{
|
||||
if ( m_clearMessageScopes ) {
|
||||
m_messageScopes.clear();
|
||||
m_clearMessageScopes = false;
|
||||
}
|
||||
auto _ = scopedDeactivate( *m_outputRedirect );
|
||||
m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) );
|
||||
}
|
||||
@@ -524,9 +528,9 @@ namespace Catch {
|
||||
|
||||
void RunContext::assertionPassedFastPath(SourceLineInfo lineInfo) {
|
||||
m_lastKnownLineInfo = lineInfo;
|
||||
m_lastAssertionPassed = true;
|
||||
++m_totals.assertions.passed;
|
||||
m_messageScopes.clear();
|
||||
m_lastAssertionPassed = true;
|
||||
m_clearMessageScopes = true;
|
||||
}
|
||||
|
||||
bool RunContext::aborting() const {
|
||||
|
||||
Reference in New Issue
Block a user