hardburn,
I have to completely disagree with you. The *nix utility
grep
is a compiled C program specifically designed for a single task. I worked
very hard to modify
tcgrep to
be nearly as fast as the *nix grep. This only worked because of my very specific
problem and still failed miserably in a general sense.
I am not sure what you mean by read normally instead of line-by-line. As
best as I can tell, both Perl and grep see the file as a data stream. They read
data into a buffer, they then process that buffer "line-by-line" by terminating on
the newline character. The speed difference would be if the default buffer size is
different - i.e. actual less physical reads as they only go back out to disk when
the buffer is empty.
I agree that Perl offers all the functionality of the *nix grep and more, so resorting
to using it for any reason other than raw speed seems like a bad idea. I would say that
the reason not to use it isn't because of security or maintainability even though these
are very valid points. To me, it is because of portability. This isn't even a matter of
Win32 vs *nix portability - as can be seen in this thread.
Cheers - L~R
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.