Micro-optimisation: use PL_globalstash instead of looking up
Rafael Garcia-Suarez [Tue, 27 Sep 2005 09:18:42 +0000 (09:18 +0000)]
CORE::GLOBAL::require by name

p4raw-id: //depot/perl@25615

op.c

diff --git a/op.c b/op.c
index fa6723f..275e9fd 100644 (file)
--- a/op.c
+++ b/op.c
@@ -5958,8 +5958,10 @@ Perl_ck_require(pTHX_ OP *o)
     if (!(o->op_flags & OPf_SPECIAL)) { /* Wasn't written as CORE::require */
        /* handle override, if any */
        gv = gv_fetchpv("require", FALSE, SVt_PVCV);
-       if (!(gv && GvCVu(gv) && GvIMPORTED_CV(gv)))
-           gv = gv_fetchpv("CORE::GLOBAL::require", FALSE, SVt_PVCV);
+       if (!(gv && GvCVu(gv) && GvIMPORTED_CV(gv))) {
+           GV **gvp = (GV**)hv_fetch(PL_globalstash, "require", 7, FALSE);
+           if (gvp) gv = *gvp; else gv = Nullgv;
+       }
     }
 
     if (gv && GvCVu(gv) && GvIMPORTED_CV(gv)) {