why a.pl is faster than b.pl

2005-12-28 Thread Jeff Pang
hi,lists, I have two perl scripts as following: a.pl: #!/usr/bin/perl use strict; my @logs = glob "~/logs/rcptstat/da2005_12_28/da.127.0.0.1.*"; foreach my $log (@logs) { open (HD,$log) or die "$!"; while(){ if ( ($_ =~ /×¢²á/o) || ($_ =~ /Õ÷ÎÄ/o) || ($_ =~ /Ê¥µ®¿ìÀÖ/)

Re: why a.pl is faster than b.pl

2005-12-28 Thread Chris Devers
On Wed, 28 Dec 2005, Jeff Pang wrote: > Why the a.pl is faster than b.pl? I think ever the resulte should be > opposite.Thanks. The easiest way to answer such questions is to benchmark and profile where the time in each script is being spent. These two scripts are so different in composition t

Re: why a.pl is faster than b.pl

2005-12-28 Thread Bob Showalter
Jeff Pang wrote: hi,lists, I have two perl scripts as following: a.pl: #!/usr/bin/perl use strict; my @logs = glob "~/logs/rcptstat/da2005_12_28/da.127.0.0.1.*"; foreach my $log (@logs) { open (HD,$log) or die "$!"; while(){ if ( ($_ =~ /×¢²á/o) || ($_ =~ /Õ÷ÎÄ/o) || ($_ =~ /

Re: why a.pl is faster than b.pl

2005-12-28 Thread Jeff Pang
- >From: Bob Showalter <[EMAIL PROTECTED]> >Sent: Dec 29, 2005 2:54 AM >To: Jeff Pang <[EMAIL PROTECTED]> >Cc: beginners@perl.org >Subject: Re: why a.pl is faster than b.pl > >Jeff Pang wrote: >> hi,lists, >> >> I have two perl scripts as following: &g

Re: why a.pl is faster than b.pl

2005-12-29 Thread Bob Showalter
Jeff Pang wrote: Hi,bob, You said: 3. It will probably be faster to use a single regex of the format: /pata|patb|patc|patd/ In fact maybe you are wrong on this. Darn. First time this year :-) Based on my test case,the RE written as below: /pata/ || /patb/ || /patc/ || /patd/ is mu

Re: why a.pl is faster than b.pl

2005-12-29 Thread Chris Devers
On Thu, 29 Dec 2005, Bob Showalter wrote: > Jeff Pang wrote: > > Hi,bob, > > > > You said: > > > > 3. It will probably be faster to use a single regex of the format: > > > > /pata|patb|patc|patd/ > > > > > > In fact maybe you are wrong on this. > > Darn. First time this year :-) > > >