summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-02-02 12:31:30 +0000
committerNicholas Clark <nick@ccl4.org>2006-02-02 12:31:30 +0000
commitfafc274c285207343d70f4a0d51c29a2f492863a (patch)
tree29385941f0aac28b61f00fd479320bb32afe923f /gv.c
parentaee92da27d05dcab09a64434715b0fb947860fad (diff)
downloadperl-fafc274c285207343d70f4a0d51c29a2f492863a.tar.gz
gv_fetchpvn_flags ranks highly in the profile, and the ::/' scanning
loop is iterated over millions of times. Add a flag GV_NOTQUAL purely as an optimisation, when the caller is passing in a string that is known not to contain any package separators. p4raw-id: //depot/perl@27053
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index 0cf779f0b1..492c1f3f2f 100644
--- a/gv.c
+++ b/gv.c
@@ -762,10 +762,17 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
HV *stash = NULL;
const I32 no_init = flags & (GV_NOADD_NOINIT | GV_NOINIT);
const I32 no_expand = flags & GV_NOEXPAND;
- const I32 add = flags & ~SVf_UTF8 & ~GV_NOADD_NOINIT & ~GV_NOEXPAND;
+ const I32 add =
+ flags & ~SVf_UTF8 & ~GV_NOADD_NOINIT & ~GV_NOEXPAND & ~GV_NOTQUAL;
const char *const name_end = nambeg + full_len;
const char *const name_em1 = name_end - 1;
+ if (flags & GV_NOTQUAL) {
+ /* Caller promised that there is no stash, so we can skip the check. */
+ len = full_len;
+ goto no_stash;
+ }
+
if (full_len > 2 && *name == '*' && isALPHA(name[1])) {
/* accidental stringify on a GV? */
name++;
@@ -827,6 +834,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
/* No stash in name, so see how we can default */
if (!stash) {
+ no_stash:
if (len && isIDFIRST_lazy(name)) {
bool global = FALSE;