From ac96ac75681ddb8f557c1608f346c2cb4ccea044 Mon Sep 17 00:00:00 2001 From: LuisAntonRebollo Date: Fri, 30 May 2014 00:16:43 +0200 Subject: [PATCH] Fix AssertFatal/TORQUE_UNUSED are not optimized on release build causing performance problems. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/ > "Both gcc and MSVC are smart enough to optimize out the evaluation of x, but only if they can determine if there are no side effects associated with the evaluation. Unfortunately, this can only be done if the body of x is known entirely to the compiler. If x is a function call to another module MSVC can still make it go away with Link-Time Code Generation (via cross-module inlining), but poor gcc is dead in the water and emits the call. Either way, we’re relying on compiler and linker optimizations to make this code go away." --- Engine/source/platform/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/platform/types.h b/Engine/source/platform/types.h index 8ce702a3c..0a7bd63ba 100644 --- a/Engine/source/platform/types.h +++ b/Engine/source/platform/types.h @@ -40,7 +40,7 @@ typedef double F64; ///< Compiler independent 64-bit float struct EmptyType {}; ///< "Null" type used by templates -#define TORQUE_UNUSED(var) (void)(var) +#define TORQUE_UNUSED(var) (void)sizeof(var) //------------------------------------------------------------------------------ //------------------------------------- String Types