Let reporters opt into fast path in RunContext::assertionStarting

The fast path allows `RunContext` to skip disabling output redirect,
and notifying the reporters, turning `RunContext::notifyAssertionStarted`
into a no-op. This improves the overall performance of assertion handling
significantly, and also prepares ground for future changes around
assertion handling and thread safety.

For simple 10M assertion run, this improves the running time by ~30%
in Debug build and ~40% in Release build.

For backwards-compatibility reasons, the fast path is disabled
by default. However, none of the first party reporters use the
`assertionStarting` event, so all first party reporters are opted-in.
This commit is contained in:
Martin Hořeňovský
2025-07-17 13:13:08 +02:00
parent ae33e5b99a
commit c22096846c
15 changed files with 41 additions and 7 deletions

View File

@@ -54,6 +54,7 @@ public:
ValidatingTestListener(Catch::IConfig const* config) :
EventListenerBase(config) {
m_preferences.shouldReportAllAssertions = true;
m_preferences.shouldReportAllAssertionStarts = true;
}
void testRunStarting( Catch::TestRunInfo const& ) override {