Ok I've tried different versions of this program
#!/usr/bin/perl use strict; print get_time() ."\n"; my $count = 0; my $pr_regex= "program.jsp?id=1"; $pr_regex = qr/\Q$pr_regex\E/oi; #open(LOGFILE,"file.txt"); @ARGV = qw(file.txt); close ARGV; #while (<LOGFILE>) { while (<>) { $count ++ if m/$pr_regex/oi; } print qq|$count\n|; print "\n" .get_time() ."\n"; exit; sub get_time { my ($sec,$min,$hour,@junk) = localtime(time); $min = '0' . $min if ($min<10); $sec = '0' . $sec if ($sec<10); return qq|$hour:$min:$sec|; }

and the output is :

bash-2.03$ perl -w agrsel_mark3.cgi
14:27:05
203

14:27:26

so around 20 seconds to find one string. That's after a little tweaking to get it down from 26 seconds.
Here's a version of my original (just looking for one string though):

#!/usr/bin/perl use strict; print get_time() ."\n"; my $count = 0; my $pr_regex= "program.jsp?id=1"; $count = `grep -c '$pr_regex' file.txt`; print qq|$count\n|; print "\n" .get_time() ."\n"; exit; sub get_time { my ($sec,$min,$hour,@junk) = localtime(time); $min = '0' . $min if ($min<10); $sec = '0' . $sec if ($sec<10); return qq|$hour:$min:$sec|; }


and the output:
bash-2.03$ perl -w agrsel_mark4.cgi
14:27:34
203


14:27:40

about 6 seconds.
actually running the full program it takes about 8 seconds a string over the first 68 strings, not quite 9 minutes.
And the regex version takes about 26 minutes to run the first 68 strings.
a little quick math tells me I'm looking at 2 hours versus 6 hours when I start really using the program.
I've tried the reg_ex version a few different ways but the time doesn't get any better then 20 seconds.
Any ideas on how to jump this up a little?
Thanks again
John

In reply to Re: some forking help by JohnATmbd
in thread some forking help by JohnATmbd

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.