diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-10-17 18:14:40 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-17 20:16:14 -0700 |
commit | f0ee386351fbbf1a41ead86e9163f688d1b37dc1 (patch) | |
tree | b668d33c61d095ba5b59caa3c43dc7480edec02f /doop.c | |
parent | 586e992d6da290482e162f13db0dd3f4533b4cd6 (diff) | |
download | perl-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.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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); } |