There doesn't seem to be a significant difference between the  [AaEeIiOoUu]{2} and  [AaEeIiOoUu][AaEeIiOoUu] variations under Strawberry 5.14.4, but I was a bit surprised that there's so little improvement over the  /i version.

c:\@Work\Perl\monks>perl -wMstrict -le "use Benchmark qw(cmpthese); ;; print 'Perl version: ', $]; ;; my $s = 'Aid bears out '; $s = $s x 10_000_000; print 'length: ', length $s; ;; cmpthese(-1, { '/i' => sub { $s =~ m{ (?i) [aeiou]{2} }xmsg }, '[Aa]{2}' => sub { $s =~ m{ [AaEeIiOoUu]{2} }xmsg }, '[Aa][Aa]' => sub { $s =~ m{ [AaEeIiOoUu][AaEeIiOoUu] }xmsg }, }); " Perl version: 5.014004 length: 140000000 Rate /i [Aa]{2} [Aa][Aa] /i 3276565/s -- -8% -9% [Aa]{2} 3558515/s 9% -- -1% [Aa][Aa] 3600879/s 10% 1% --

The results are closer to what you suggest under ActiveState 5.8.9, but with  /i still surprisingly high.

c:\@Work\Perl>perl -wMstrict -le "(source code as above) " Perl version: 5.008009 length: 140000000 Rate [Aa]{2} /i [Aa][Aa] [Aa]{2} 3276565/s -- -6% -16% /i 3480139/s 6% -- -11% [Aa][Aa] 3918166/s 20% 13% --

Still, as you say, it's a bit of a micro-optimization.


In reply to Re^4: Vowel search by AnomalousMonk
in thread Vowel search by Noob@Perl

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.