Change 31704 by [EMAIL PROTECTED] on 2007/08/12 14:20:44
Subject: Re: [PATCH] Optimize split //
From: Ãvar Arnfjörð Bjarmason <[EMAIL PROTECTED]>
Date: Sat, 11 Aug 2007 20:33:49 +0000
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/pp.c#595 edit
Differences ...
==== //depot/perl/pp.c#595 (text) ====
Index: perl/pp.c
--- perl/pp.c#594~31693~ 2007-08-09 03:10:37.000000000 -0700
+++ perl/pp.c 2007-08-12 07:20:44.000000000 -0700
@@ -4726,26 +4726,36 @@
else
EXTEND(SP, slen);
- while (--limit) {
- m = s;
-
- if (do_utf8)
+ if (do_utf8) {
+ while (--limit) {
+ /* keep track of how many bytes we skip over */
+ m = s;
s += UTF8SKIP(s);
- else
- ++s;
+ dstr = newSVpvn(m, s-m);
- dstr = newSVpvn(m, s-m);
+ if (make_mortal)
+ sv_2mortal(dstr);
- if (make_mortal)
- sv_2mortal(dstr);
- if (do_utf8)
(void)SvUTF8_on(dstr);
+ PUSHs(dstr);
- PUSHs(dstr);
+ if (s >= strend)
+ break;
+ }
+ } else {
+ while (--limit) {
+ dstr = newSVpvn(s, 1);
- /* are we there yet? */
- if (s >= strend)
- break;
+ s++;
+
+ if (make_mortal)
+ sv_2mortal(dstr);
+
+ PUSHs(dstr);
+
+ if (s >= strend)
+ break;
+ }
}
}
else if (do_utf8 == ((rx->extflags & RXf_UTF8) != 0) &&
End of Patch.