[Memphis.pm] perl one liner

Hal Phillips HPhillips at harrahs.com
Wed Sep 26 13:29:11 CDT 2001


Kewl, thanks!  The first time I ran it, it was 22 seconds... but the second
and third it was 6.19 and 6.21.  I wonder about the 22....   That Deparse is
pretty sweet.
-hal

> -----Original Message-----
> From:	Steve Lane [SMTP:sml at zfx.com]
> Sent:	Wednesday, September 26, 2001 12:44 PM
> To:	memphis-pm-list at pm.org
> Subject:	Re: [Memphis.pm] perl one liner
> 
> Hal Phillips wrote:
> > 
> > Interesting, I ran this on and AIX s80 w 8gig of ram versus wc -l on a
> nigh
> > million line file, and the perl won on time....  I wouldn't have guessed
> it!
> > 
> > box:/tmp> timex perl -lpe '}$_=$.;{' hal.tmp
> > 989702
> > 
> > real 6.83
> > user 5.42
> > sys  1.41
> > 
> > box:/tmp> timex wc -l hal.tmp
> >   989702 hal.tmp
> > 
> > real 11.45
> > user 9.77
> > sys  1.68
> 
> this is likely to be a hair faster:
> 
> timex perl -ne '}print$.-1 ."\n";{' hal.tmp
> 
> it's about 1% faster on my machine.
> 
> if you've got Deparse and want to see what's going
> on with these examples, run these commands...
> 
> perl -MO=Deparse -lpe '}$_=$.;{' hal.tmp
> perl -MO=Deparse -ne '}print$.-1 ."\n";{' hal.tmp
> 
> --
> Steve Lane <sml at zfx.com>
> --------------------------------------------------------------------------
> --
> To unsubscribe, please send email to majordomo at pm.org
> with 'unsubscribe memphis-pm-list' in the body of the message.
> --------------------------------------------------------------------------
> --
> 
----------------------------------------------------------------------------
To unsubscribe, please send email to majordomo at pm.org
with 'unsubscribe memphis-pm-list' in the body of the message.
----------------------------------------------------------------------------




More information about the Memphis-pm mailing list