summaryrefslogtreecommitdiff
path: root/toke.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 /toke.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 'toke.c')
-rw-r--r--toke.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/toke.c b/toke.c
index fafd82e910..95f86fa372 100644
--- a/toke.c
+++ b/toke.c
@@ -2893,8 +2893,8 @@ Perl_yylex(pTHX)
* at least, set argv[0] to the basename of the Perl
* interpreter. So, having found "#!", we'll set it right.
*/
- SV * const x
- = GvSV(gv_fetchpvs("\030", GV_ADD, SVt_PV)); /* $^X */
+ SV * const x = GvSV(gv_fetchpvs("\030", GV_ADD|GV_NOTQUAL,
+ SVt_PV)); /* $^X */
assert(SvPOK(x) || SvGMAGICAL(x));
if (sv_eq(x, CopFILESV(PL_curcop))) {
sv_setpvn(x, ipath, ipathend - ipath);
@@ -3127,7 +3127,7 @@ Perl_yylex(pTHX)
case 'T': ftst = OP_FTTEXT; break;
case 'B': ftst = OP_FTBINARY; break;
case 'M': case 'A': case 'C':
- gv_fetchpvs("\024",GV_ADD, SVt_PV);
+ gv_fetchpvs("\024", GV_ADD|GV_NOTQUAL, SVt_PV);
switch (tmp) {
case 'M': ftst = OP_FTMTIME; break;
case 'A': ftst = OP_FTATIME; break;
@@ -4694,7 +4694,8 @@ Perl_yylex(pTHX)
}
case KEY_chdir:
- (void)gv_fetchpvs("ENV", GV_ADD, SVt_PVHV); /* may use HOME */
+ /* may use HOME */
+ (void)gv_fetchpvs("ENV", GV_ADD|GV_NOTQUAL, SVt_PVHV);
UNI(OP_CHDIR);
case KEY_close:
@@ -5668,10 +5669,11 @@ Perl_yylex(pTHX)
char ctl_l[2];
ctl_l[0] = toCTRL('L');
ctl_l[1] = '\0';
- gv_fetchpvn_flags(ctl_l, 1, GV_ADD, SVt_PV);
+ gv_fetchpvn_flags(ctl_l, 1, GV_ADD|GV_NOTQUAL, SVt_PV);
}
#else
- gv_fetchpvs("\f", GV_ADD, SVt_PV); /* Make sure $^L is defined */
+ /* Make sure $^L is defined */
+ gv_fetchpvs("\f", GV_ADD|GV_NOTQUAL, SVt_PV);
#endif
UNI(OP_ENTERWRITE);
@@ -10016,7 +10018,7 @@ S_scan_inputsymbol(pTHX_ char *start)
Copy("ARGV",d,5,char);
/* Check whether readline() is overriden */
- gv_readline = gv_fetchpvs("readline", 0, SVt_PVCV);
+ gv_readline = gv_fetchpvs("readline", GV_NOTQUAL, SVt_PVCV);
if ((gv_readline
&& GvCVu(gv_readline) && GvIMPORTED_CV(gv_readline))
||