Actually, pre-applying lc did not fare so well:

use strict; use warnings; use Benchmark 'cmpthese'; my $string = 'TwAs BrIlLiG aNd ThE sLiThY tOvEs DiD gYrE aNd GiMbLe'; cmpthese( -1, { i_s => sub { local $_ = $string; /gimble/i }, I_s => sub { local $_ = $string; /GiMbLe/ }, lc_s => sub { local $_ = lc $string; /gimble/ }, i_f => sub { local $_ = $string; /foobar/i }, I_f => sub { local $_ = $string; /foobar/ }, lc_f => sub { local $_ = lc $string; /foobar/ }, } ); __END__ Rate lc_f lc_s i_s I_s i_f I_f lc_f 459364/s -- -4% -13% -27% -33% -33% lc_s 477204/s 4% -- -10% -24% -30% -30% i_s 530962/s 16% 11% -- -15% -22% -22% I_s 628278/s 37% 32% 18% -- -8% -8% i_f 681314/s 48% 43% 28% 8% -- -0% I_f 681315/s 48% 43% 28% 8% 0% --

the lowliest monk


In reply to Re^2: Slowness of /i by tlm
in thread Slowness of /i by sulfericacid

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.