Save one NULL assignment per TMP
authorSteffen Mueller <smueller@cpan.org>
Wed, 12 Sep 2012 12:52:46 +0000 (14:52 +0200)
committerSteffen Mueller <smueller@cpan.org>
Sun, 16 Sep 2012 11:41:38 +0000 (13:41 +0200)
This assignment looks really rather like overzealous cleanliness.
It's a hot path. Now it's death by 999 cuts instead of 1000.

scope.c

diff --git a/scope.c b/scope.c
index e3b4c79..42e3af8 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -160,8 +160,13 @@ Perl_free_tmps(pTHX)
     /* XXX should tmps_floor live in cxstack? */
     const I32 myfloor = PL_tmps_floor;
     while (PL_tmps_ix > myfloor) {      /* clean up after last statement */
-       SV* const sv = PL_tmps_stack[PL_tmps_ix];
-       PL_tmps_stack[PL_tmps_ix--] = NULL;
+#ifdef PERL_POISON
+        SV* const sv = PL_tmps_stack[PL_tmps_ix];
+        PoisonWith(sv, 1, sizeof(SV *), 0xAB);
+        PL_tmps_ix--;
+#else
+       SV* const sv = PL_tmps_stack[PL_tmps_ix--];
+#endif
        if (sv && sv != &PL_sv_undef) {
            SvTEMP_off(sv);
            SvREFCNT_dec(sv);           /* note, can modify tmps_ix!!! */