summaryrefslogtreecommitdiff
path: root/scope.h
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgs@consttype.org>2009-11-15 01:34:03 +0100
committerRafael Garcia-Suarez <rgs@consttype.org>2009-11-15 01:34:48 +0100
commitd0f83c37b9d28134de63d7e3eb8427ccf56ca5ba (patch)
tree464ae0213fb4d5ad737dcc45f339fdd942c87f81 /scope.h
parent689e417f571b6d714ad62b19aa8883b3b04f59ed (diff)
downloadperl-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.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/scope.h b/scope.h
index 9fd3bce578..2f50398eab 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