On Fri, Apr 12, 2013 at 04:53:52PM +0530, kavita kulkarni wrote:
> Thanks all, got many ideas from you..
>
> My script took ~7 min to run with data file of ~50,000 lines with
> substr()/unpack() enabled and same script took ~2 min after disabling
> substr()/unpack().
No one has asked what kind of hardware you're running this on, so I will.
Reading the thread, I created a very simplistic test:
michael@post:~$ wc -l /var/log/
mail.info
973819 /var/log/
mail.info
michael@post:~$ time perl -ne '$t = substr $_, 4, 9; $s = substr $_, 11, 15; print $t,$s,$/;' /var/log/
mail.info > /dev/null
real 0m2.253s
user 0m2.104s
sys 0m0.148s
michael@post:~$
Over 970,000 lines processed with substr, extracting two substrings from positions described in an
earlier email of yours. Total processing time less than 3 seconds.
I don't believe substr extracting strings is your bottleneck. We really could use some sample data and code to assist.
--
Michael Rasmussen, Portland Oregon
Be Appropriate && Follow Your Curiosity
Other Adventures:
http://www.jamhome.us/ or
http://gplus.to/MichaelRpdx
A special random fortune cookie fortune:
In general, they do what you want, unless you want consistency.
~ Larry Wall