What’s going on here is that you’ve hit an old 5.8 bug from more than five years ago. If you change the first argument to timethese to 0 so that it calculates them for you, here are the results:
% perl5.8 ~/906678.pl
Is_utf8 My €0.02 of info
Is_utf8 الأنشطة
Benchmark: running ara nocmt 1step, ara nocmt 2step, ara w-cmt 1step, ara w-cmt 2step, lat nocmt 1step, lat nocmt 2step, lat w-cmt 1step, lat w-cmt 2step for at least 3 CPU seconds...
ara nocmt 1step:  4 wallclock secs ( 3.58 usr +  0.01 sys =  3.59 CPU) @  0.56/s (n=2)
            (warning: too few iterations for a reliable count)
ara nocmt 2step:  3 wallclock secs ( 3.14 usr +  0.01 sys =  3.15 CPU) @ 983039.68/s (n=3096575)
ara w-cmt 1step:  4 wallclock secs ( 3.58 usr +  0.01 sys =  3.59 CPU) @  0.56/s (n=2)
            (warning: too few iterations for a reliable count)
ara w-cmt 2step:  3 wallclock secs ( 3.11 usr +  0.01 sys =  3.12 CPU) @ 840413.46/s (n=2622090)
lat nocmt 1step:  4 wallclock secs ( 3.13 usr +  0.02 sys =  3.15 CPU) @ 1664822.54/s (n=5244191)
lat nocmt 2step:  3 wallclock secs ( 3.12 usr +  0.01 sys =  3.13 CPU) @ 923365.81/s (n=2890135)
lat w-cmt 1step:  4 wallclock secs ( 3.09 usr +  0.00 sys =  3.09 CPU) @ 1437420.39/s (n=4441629)
lat w-cmt 2step:  4 wallclock secs ( 3.11 usr +  0.01 sys =  3.12 CPU) @ 789479.17/s (n=2463175)

% perl5.10 ~/906678.pl
Is_utf8 My €0.02 of info
Is_utf8 الأنشطة
Benchmark: running ara nocmt 1step, ara nocmt 2step, ara w-cmt 1step, ara w-cmt 2step, lat nocmt 1step, lat nocmt 2step, lat w-cmt 1step, lat w-cmt 2step for at least 3 CPU seconds...
ara nocmt 1step:  3 wallclock secs ( 3.17 usr +  0.02 sys =  3.19 CPU) @ 1592576.80/s (n=5080320)
ara nocmt 2step:  4 wallclock secs ( 3.16 usr +  0.00 sys =  3.16 CPU) @ 803844.94/s (n=2540150)
ara w-cmt 1step:  3 wallclock secs ( 3.14 usr + -0.01 sys =  3.13 CPU) @ 1481335.46/s (n=4636580)
ara w-cmt 2step:  4 wallclock secs ( 3.27 usr +  0.01 sys =  3.28 CPU) @ 695634.45/s (n=2281681)
lat nocmt 1step:  3 wallclock secs ( 3.25 usr +  0.01 sys =  3.26 CPU) @ 1511156.44/s (n=4926370)
lat nocmt 2step:  4 wallclock secs ( 3.20 usr +  0.01 sys =  3.21 CPU) @ 791326.79/s (n=2540159)
lat w-cmt 1step:  3 wallclock secs ( 3.13 usr +  0.01 sys =  3.14 CPU) @ 1336099.36/s (n=4195352)
lat w-cmt 2step:  3 wallclock secs ( 3.18 usr +  0.01 sys =  3.19 CPU) @ 686363.01/s (n=2189498)

% perl5.12 ~/906678.pl
Is_utf8 My €0.02 of info
Is_utf8 الأنشطة
Benchmark: running ara nocmt 1step, ara nocmt 2step, ara w-cmt 1step, ara w-cmt 2step, lat nocmt 1step, lat nocmt 2step, lat w-cmt 1step, lat w-cmt 2step for at least 3 CPU seconds...
ara nocmt 1step:  4 wallclock secs ( 3.21 usr +  0.00 sys =  3.21 CPU) @ 1937381.31/s (n=6218994)
ara nocmt 2step:  3 wallclock secs ( 3.11 usr +  0.01 sys =  3.12 CPU) @ 766259.94/s (n=2390731)
ara w-cmt 1step:  3 wallclock secs ( 3.07 usr +  0.01 sys =  3.08 CPU) @ 1481614.61/s (n=4563373)
ara w-cmt 2step:  3 wallclock secs ( 3.12 usr +  0.01 sys =  3.13 CPU) @ 670184.03/s (n=2097676)
lat nocmt 1step:  2 wallclock secs ( 3.05 usr +  0.01 sys =  3.06 CPU) @ 1992276.47/s (n=6096366)
lat nocmt 2step:  4 wallclock secs ( 3.08 usr +  0.01 sys =  3.09 CPU) @ 750254.05/s (n=2318285)
lat w-cmt 1step:  3 wallclock secs ( 3.07 usr +  0.01 sys =  3.08 CPU) @ 1647204.22/s (n=5073389)
lat w-cmt 2step:  3 wallclock secs ( 3.08 usr +  0.01 sys =  3.09 CPU) @ 678859.55/s (n=2097676)

% perl5.14 ~/906678.pl
Is_utf8 My €0.02 of info
Is_utf8 الأنشطة
Benchmark: running ara nocmt 1step, ara nocmt 2step, ara w-cmt 1step, ara w-cmt 2step, lat nocmt 1step, lat nocmt 2step, lat w-cmt 1step, lat w-cmt 2step for at least 3 CPU seconds...
ara nocmt 1step:  4 wallclock secs ( 3.00 usr +  0.01 sys =  3.01 CPU) @ 2013724.92/s (n=6061312)
ara nocmt 2step:  3 wallclock secs ( 3.26 usr +  0.01 sys =  3.27 CPU) @ 828593.88/s (n=2709502)
ara w-cmt 1step:  4 wallclock secs ( 3.16 usr +  0.00 sys =  3.16 CPU) @ 1714874.68/s (n=5419004)
ara w-cmt 2step:  4 wallclock secs ( 3.32 usr +  0.01 sys =  3.33 CPU) @ 678051.05/s (n=2257910)
lat nocmt 1step:  2 wallclock secs ( 3.08 usr +  0.01 sys =  3.09 CPU) @ 2063201.94/s (n=6375294)
lat nocmt 2step:  4 wallclock secs ( 3.30 usr + -0.01 sys =  3.29 CPU) @ 823556.84/s (n=2709502)
lat w-cmt 1step:  3 wallclock secs ( 3.17 usr + -0.01 sys =  3.16 CPU) @ 1607695.89/s (n=5080319)
lat w-cmt 2step:  4 wallclock secs ( 3.19 usr +  0.01 sys =  3.20 CPU) @ 684215.00/s (n=2189488)

See? No more problem. Not only that, it’s getting faster, too.


In reply to Re: Very slow regex substitution on Unicode string by tchrist
in thread Very slow regex substitution on Unicode string by pbijnens

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.