That was an interesting thread. Base on those numbers, double and single quote really does not have much speed difference and the difference is not consistent. bass_warrior's testing was meaningless, he made up cases to drive a pre-determined conclusion.

I slightly modified the first set of benchmark provided by Anonymous Monk, and when the string is a little bit longer, the chance of winning between double and single quote becomes really close to 50-50:

use warnings; use Benchmark("cmpthese"); cmpthese(-1, { "double", q !eval q {$a = "this is a string" x 10}!, 'single', q !eval q {$b = 'this is a string' x 10}!, });

Conclusion: the difference between single and double quote are more functional than performance.

Update: when I tried x 100, double seems to win more. In a way, it shows that length of the string matters here. The overall conclusion stays, the speed difference does not mean much.


In reply to Re^2: Differences between " " and ' '? by pg
in thread Differences between " " and ' '? by Ace128

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.