diff options
author | Rafael Garcia-Suarez <rgs@consttype.org> | 2009-11-15 01:34:03 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2009-11-15 01:34:48 +0100 |
commit | d0f83c37b9d28134de63d7e3eb8427ccf56ca5ba (patch) | |
tree | 464ae0213fb4d5ad737dcc45f339fdd942c87f81 /scope.h | |
parent | 689e417f571b6d714ad62b19aa8883b3b04f59ed (diff) | |
download | perl-d0f83c37b9d28134de63d7e3eb8427ccf56ca5ba.tar.gz |
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.
Diffstat (limited to 'scope.h')
-rw-r--r-- | scope.h | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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 |