I have to admit to getting lost trying to read that article. However, ignorance is no reason to fail to comment ;-) In all honesty, I pretty much stopped reading after the first pair of graphs and it appearing that they were picking some rather pathological cases. They were picking on Perl's well-known worst-case scenarios, and comparing them to another regex engine that had chosen differing optimisations. I'm sure that someone here could pick another pathological expression that would highlight perl's vast superiority in optimisation on that string - which, most likely, would completely avoid the regular expression engine. Neither one would be a fair comparison.

The idea really is to pick realistic data for your use (which could be delimited text, log files, shell scripts, perl code, etc., or, heaven forbid, actual regular text), and compare with that.

Where grep and awk really fall down is that to do anything remotely interesting as far as complex programming is concerned, you need to encapsulate them in a shell script. At that point, you have the overhead of forking and execing hundreds or thousands of subprocesses (including awk and/or grep), which probably vastly overshadows any possible perl slowdown on regular (non-pathological) data.


In reply to Re: Perl regexp matching is slow?? by Tanktalus
in thread Perl regexp matching is slow?? by smahesh

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.