It looks from your code that, apart from
Fregex and
Rregex, your subroutine pairs are identical as you haven't swapped the 'sgml' and 'html' around. When I run your code with them swapped around I get these results. (Rates are slow as the machine is a quite elderly SPARC.)
length of search string: 20904
Rate Rregex Fregex Rsubstr Rindex Fsubstr Findex
Rregex 11708/s -- -16% -41% -45% -61% -70%
Fregex 14005/s 20% -- -29% -35% -54% -64%
Rsubstr 19721/s 68% 41% -- -8% -35% -50%
Rindex 21423/s 83% 53% 9% -- -29% -45%
Fsubstr 30362/s 159% 117% 54% 42% -- -22%
Findex 39142/s 234% 179% 98% 83% 29% --
Cheers,
JohnGG
Update: Fixed typo.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.