A suggestion by Yamashina Hio to speed up substitutions
YAMASHINA Hio [Tue, 30 Aug 2005 17:17:23 +0000 (02:17 +0900)]
with right-hand side expressions by freeing temporaries.
See :

Subject: s///ge; consumes PL_tmps_stack in its loop
Message-Id: <20050830160113.9716.HIO@ymir.co.jp>

p4raw-id: //depot/perl@26334

pp_ctl.c

index b49a5b5..401f60f 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -207,6 +207,7 @@ PP(pp_substcont)
        if (!(cx->sb_rxtainted & 2) && SvTAINTED(TOPs))
            cx->sb_rxtainted |= 2;
        sv_catsv(dstr, POPs);
+       FREETMPS; /* Prevent excess tmp stack */
 
        /* Are we done */
        if (cx->sb_once || !CALLREGEXEC(aTHX_ rx, s, cx->sb_strend, orig,