#define SOMETHING1 STMT_START { assert( something ); if(some_complex_condition) wrapped_function1( aTHX_, ... ); assert(something_else ) } STMT_END #define SOMETHING2 STMT_START { assert( something ); if(some_complex_condition) wrapped_function2( aTHX_, ... ); assert(something_else ) } STMT_END #define SOMETHING3 STMT_START { assert( something ); if(some_complex_condition) wrapped_function3( aTHX_, ... ); assert(something_else ) } STMT_END int someFunction( aTHX_ ... ) { dATHX; ...; SOMETHING1( ... ); ...; SOMETHING2( ... ); ...; SOMETHING3( ... ); RETURN; } #### #include #include char b[ 30 ] = {0,}; char *commify( ULONG64 n ) { void *x = memset( b, 0, 30 ); int c1 = sprintf( b, "%I64u", (ULONG64)n ); int c2 = c1; int c = 0; while( ( c1 -= 3 ) > 0 ) { memmove( &b[ c1 + 1 ], &b[ c1 ], c2 - c1 + c ); b[ c1 ] = ','; c++; } return b; } volatile int x; void x1( int i ) { x = i; return; } void x2( int i ) { if( !( i & 1 ) ) return; x = i; return; } int main( int argc, char **argv ) { int n = atol( argv[1] ); int i; ULONG64 start, end; HANDLE hThread = GetCurrentThread(); QueryThreadCycleTime( hThread, &start ); for( i = 0; i < n; ++i ) if( i & 1 ) x1( i ); QueryThreadCycleTime( hThread, &end ); printf( "Inline condition: %15.15s\n", commify( end - start ) ); QueryThreadCycleTime( hThread, &start ); for( i = 0; i < n; ++i ) x2( i ); QueryThreadCycleTime( hThread, &end ); printf( "Inbody condition: %15.15s\n", commify( end - start ) ); return 0; } #### C:\test>cl /Ox calloverhead.c Microsoft (R) C/C++ Optimizing Compiler Version 15.00.21022.08 for x64 Copyright (C) Microsoft Corporation. All rights reserved. calloverhead.c Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. /out:calloverhead.exe calloverhead.obj C:\test>calloverhead 10000000 Inline condition: 60,068,106 Inbody condition: 45,064,458 C:\test>calloverhead 10000000 Inline condition: 60,037,515 Inbody condition: 45,084,879 C:\test>calloverhead 10000000 Inline condition: 60,048,828 Inbody condition: 45,057,681 C:\test>calloverhead 10000000 Inline condition: 60,032,691 Inbody condition: 45,032,724