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:
Neal Coombes 2017-11-20 09:11:30 -06:00
parent 7732835f9a
commit f7b3cb515b
4 changed files with 11 additions and 11 deletions

View File

@ -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 ) {

View File

@ -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 );

View File

@ -20,7 +20,7 @@ namespace Catch {
return m_runner;
}
virtual IConfigPtr getConfig() const override {
virtual IConfigPtr const & getConfig() const override {
return m_config;
}

View File

@ -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