Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Matching lines in 2+ GB logfiles.

by linuxer (Curate)
on May 01, 2008 at 15:28 UTC ( #683947=note: print w/replies, xml ) Need Help??


in reply to Matching lines in 2+ GB logfiles.

Just my first thought; so instead of

while ( $window =~ m/\w{3}\s{1,2}\d{1,2}.*$re.*\n/oigc ) {
you could try
while ( $window =~ m/\w\w\w\s\s?\d\d?.*$re.*\n/iogc ) {

\w\w\w should run faster than \w{3}, same with \d\d? instead of \d{1,2}

Edit: and same with \s\s? vs. \s{1,2}. The direction should be clear.

Edit2: Maybe precompiling the regex with the qr// Operator might give another speedup.
By the way, I can't remember that /c Modifier, what is it for?

Replies are listed 'Best First'.
Re^2: Matching lines in 2+ GB logfiles.
by CountZero (Bishop) on May 01, 2008 at 16:25 UTC
    The /c modifier is always used together with the /g modifier and allows continued search after a failed /g match. Normally pos() is reset after a failed match.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://683947]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-01-27 06:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (70 votes). Check out past polls.

    Notices?