First off, I don't like that rand there - it makes things much more difficult to replicate. So, after running your test as-is a few times, I went and just changed "rand(1000)" to "1000" and reran it. I got slightly more consistant answers when the strings where consistantly sized.

At no time have I had pack outperform join. Although my CPU seems to be a bit slower than yours ... I never got over 100 runs per second.

As-is: Rate pack join pack 80.0/s -- -15% join 93.7/s 17% -- Always 1000: Rate pack join pack 46.0/s -- -8% join 50.0/s 9% -- x $i rather than x 1000 or x rand(1000): Rate pack join pack 74.0/s -- -14% join 86.0/s 16% --
Since it seems that the longer the strings, the closer they were, I tried 10,000.
Rate pack join pack 5.66/s -- -5% join 5.94/s 5% --
It doesn't seem that I can get pack outperforming join on this issue. And that's probably despite being utf-8 aware...

Tests above were run on a threaded perl 5.8.7 on Linux


In reply to Re^3: Various ways to concatenating an array of strings by Tanktalus
in thread Various ways to concatenating an array of strings by hawtin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.