diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-02-02 12:31:30 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-02-02 12:31:30 +0000 |
commit | fafc274c285207343d70f4a0d51c29a2f492863a (patch) | |
tree | 29385941f0aac28b61f00fd479320bb32afe923f /gv.c | |
parent | aee92da27d05dcab09a64434715b0fb947860fad (diff) | |
download | perl-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.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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; |