Put optimised substr assignment in void context
authorFather Chrysostomos <sprout@cpan.org>
Mon, 5 Dec 2011 20:55:57 +0000 (12:55 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 5 Dec 2011 21:44:00 +0000 (13:44 -0800)
24fcb59fc optimised substr assignment in void context down to four-arg
substr, causing considerable speed-up, but did not take the extra step
of marking the substr op itself as being in void context, so pp_substr
was still constructing a return value.  This commit speed things up
just a tiny bit more.

op.c

diff --git a/op.c b/op.c
index 1ed3dae..e353015 100644 (file)
--- a/op.c
+++ b/op.c
@@ -10315,6 +10315,8 @@ Perl_rpeep(pTHX_ register OP *o)
                            cBINOPx(left)->op_first->op_sibling;
                        cBINOPx(left)->op_first->op_sibling = right;
                        left->op_private |= OPpSUBSTR_REPL_FIRST;
+                       left->op_flags =
+                           (o->op_flags & ~OPf_WANT) | OPf_WANT_VOID;
                    }
                }
            }