From: Rafael Garcia-Suarez Date: Sun, 15 Nov 2009 00:34:03 +0000 (+0100) Subject: Performance optimisation in assert, suggested by Tim Bunce X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d0f83c37b9d28134de63d7e3eb8427ccf56ca5ba;p=p5sagit%2Fp5-mst-13.2.git Performance optimisation in assert, suggested by Tim Bunce Most compilers will store only a single copy of identical literal strings. So changing that assert to check the pointer first would significantly reduce the cost. --- diff --git a/scope.h b/scope.h index 9fd3bce..2f50398 100644 --- a/scope.h +++ b/scope.h @@ -140,7 +140,9 @@ scope has the given name. Name must be a literal string. #define LEAVE_with_name(name) \ STMT_START { \ DEBUG_SCOPE("LEAVE \"" name "\"") \ - assert(strEQ(PL_scopestack_name[PL_scopestack_ix-1], name)); \ + assert(((char*)PL_scopestack_name[PL_scopestack_ix-1] \ + == (char*)name) \ + || strEQ(PL_scopestack_name[PL_scopestack_ix-1], name)); \ pop_scope(); \ } STMT_END #else