summaryrefslogtreecommitdiff
path: root/doop.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-10-17 18:14:40 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-10-17 20:16:14 -0700
commitf0ee386351fbbf1a41ead86e9163f688d1b37dc1 (patch)
treeb668d33c61d095ba5b59caa3c43dc7480edec02f /doop.c
parent586e992d6da290482e162f13db0dd3f4533b4cd6 (diff)
downloadperl-f0ee386351fbbf1a41ead86e9163f688d1b37dc1.tar.gz
Use sv_catpvn instead of sv_catsv in doop.c:do_join
Bunchmarking shows that SvPV+sv_catpvn is faster that sv_catsv. Why exactly I don’t know, but perhaps fewer functions and flag checks are the cause.
Diffstat (limited to 'doop.c')
-rw-r--r--doop.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/doop.c b/doop.c
index 3b6f1e752a..007ff5e2e3 100644
--- a/doop.c
+++ b/doop.c
@@ -709,13 +709,22 @@ Perl_do_join(pTHX_ SV *sv, SV *delim, SV **mark, SV **sp)
if (delimlen) {
for (; items > 0; items--,mark++) {
+ STRLEN len;
+ const char *s;
sv_catsv_nomg(sv,delim);
- sv_catsv(sv,*mark);
+ s = SvPV_const(*mark,len);
+ sv_catpvn_flags(sv,s,len,
+ DO_UTF8(*mark) ? SV_CATUTF8 : SV_CATBYTES);
}
}
else {
for (; items > 0; items--,mark++)
- sv_catsv(sv,*mark);
+ {
+ STRLEN len;
+ const char *s = SvPV_const(*mark,len);
+ sv_catpvn_flags(sv,s,len,
+ DO_UTF8(*mark) ? SV_CATUTF8 : SV_CATBYTES);
+ }
}
SvSETMAGIC(sv);
}