The general rule of thumb, when all else is equal (or even vaguely close to equal), is to optimize for readability.

If you really must decide on the basis of performance, then the readable option wins in this case anyhow, because it gives the compiler the actual bytes it needs instead of an escape sequence which then needs to be converted into the actual bytes. Doing the conversion takes non-zero time, therefore not needing to convert will take less time. Post-compilation, the executed code will contain the actual bytes either way, so there will be no difference when the code is executed (unless you're inside a string eval or something like that which forces the escape sequence to be processed repeatedly).

But, although the conversion takes non-zero time, the time required is very near-zero. Even if your script is run millions of times, the aggregate difference in run time across all those runs will be less than the time it takes me to type this word. There's a good reason why people are so against micro-optimization - in the vast majority of cases, the time you spend to design and implement the optimization is orders of magnitude larger than the time saved when executing it.


In reply to Re: Other effects of 'use utf8' on script by dsheroh
in thread Other effects of 'use utf8' on script by YenForYang

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.