It isn't the start-up time. It is probably an effect of the working set "settling in" or any number of other things that can affect benchmark numbers. In general, a 5% or less difference isn't something I would consider "real" as running it an hour later could certainly swing the answer that much. Here is the code I used:

use Benchmark qw(cmpthese); my $str= "This is a test, " x 200; my $single= "'".$str."'"; my $double= '"'.$str.'"'; cmpthese( -3, { a_double => sub { eval $double }, b_single => sub { eval $single }, c_double => sub { eval $double }, d_single => sub { eval $single }, } );
I don't have my original results (20% difference), but a re-run gave this:
Rate a_double c_double b_single d_single a_double 4773/s -- -1% -23% -23% c_double 4830/s 1% -- -22% -22% b_single 6170/s 29% 28% -- -0% d_single 6172/s 29% 28% 0% --
        - tye (but my friends call me "Tye")

In reply to (tye)Re2: A better non-existant string... by tye
in thread A better non-existant string... by lzcd

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.