diff options
| author | Martin Hořeňovský | 2025-07-17 13:13:08 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2025-07-17 13:47:44 +0200 |
| commit | c22096846c98211e0bcd23dbbd155698fbd718b3 (patch) | |
| tree | 0d30b3d6a826cd277f559bcb8a217c3e103de444 /src/catch2/interfaces | |
| parent | ae33e5b99af6f58840f78e1986051b0c6a5823e4 (diff) | |
| download | catch3-c22096846c98211e0bcd23dbbd155698fbd718b3.tar.gz | |
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.
Diffstat (limited to 'src/catch2/interfaces')
| -rw-r--r-- | src/catch2/interfaces/catch_interfaces_reporter.hpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp index 86264118..c7217889 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.hpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp @@ -115,6 +115,11 @@ namespace Catch { //! Catch2 should call `Reporter::assertionEnded` even for passing //! assertions bool shouldReportAllAssertions = false; + //! Catch2 should call `Reporter::assertionStarting` for all assertions + // Defaults to true for backwards compatibility, but none of our current + // reporters actually want this, and it enables a fast path in assertion + // handling. + bool shouldReportAllAssertionStarts = true; }; /** |