mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-18 03:26:10 +01:00
performance improvement - ~AssertionHandler, getConfig return value
inlined ~AssertionHandler(), and changed getConfig to return shared_ptr const reference instead of by value (very expensive for shared_ptr's). Further work on #1086. Brings test from 0m20.635s to 0m17.186s
This commit is contained in:
parent
7732835f9a
commit
f7b3cb515b
@ -8,10 +8,8 @@
|
||||
|
||||
#include "catch_assertionhandler.h"
|
||||
#include "catch_assertionresult.h"
|
||||
#include "catch_interfaces_capture.h"
|
||||
#include "catch_interfaces_runner.h"
|
||||
#include "catch_interfaces_config.h"
|
||||
#include "catch_context.h"
|
||||
#include "catch_debugger.h"
|
||||
#include "catch_interfaces_registry_hub.h"
|
||||
#include "catch_capture_matchers.h"
|
||||
@ -60,12 +58,6 @@ namespace Catch {
|
||||
{
|
||||
getCurrentContext().getResultCapture()->assertionStarting( m_assertionInfo );
|
||||
}
|
||||
AssertionHandler::~AssertionHandler() {
|
||||
if ( m_inExceptionGuard ) {
|
||||
handle( ResultWas::ThrewException, "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE" );
|
||||
getCurrentContext().getResultCapture()->exceptionEarlyReported();
|
||||
}
|
||||
}
|
||||
|
||||
void AssertionHandler::handle( ITransientExpression const& expr ) {
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "catch_decomposer.h"
|
||||
#include "catch_assertioninfo.h"
|
||||
#include "catch_context.h"
|
||||
#include "catch_interfaces_capture.h"
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@ -44,7 +46,13 @@ namespace Catch {
|
||||
SourceLineInfo const& lineInfo,
|
||||
StringRef capturedExpression,
|
||||
ResultDisposition::Flags resultDisposition );
|
||||
~AssertionHandler();
|
||||
~AssertionHandler()
|
||||
{
|
||||
if ( m_inExceptionGuard ) {
|
||||
handle( ResultWas::ThrewException, "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE" );
|
||||
getCurrentContext().getResultCapture()->exceptionEarlyReported();
|
||||
}
|
||||
}
|
||||
|
||||
void handle( ITransientExpression const& expr );
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace Catch {
|
||||
return m_runner;
|
||||
}
|
||||
|
||||
virtual IConfigPtr getConfig() const override {
|
||||
virtual IConfigPtr const & getConfig() const override {
|
||||
return m_config;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace Catch {
|
||||
|
||||
virtual IResultCapture* getResultCapture() = 0;
|
||||
virtual IRunner* getRunner() = 0;
|
||||
virtual IConfigPtr getConfig() const = 0;
|
||||
virtual IConfigPtr const & getConfig() const = 0;
|
||||
};
|
||||
|
||||
struct IMutableContext : IContext
|
||||
|
Loading…
Reference in New Issue
Block a user