because awk is not built for speed; it's in fact quite slow, but does support alot of otherwise useful features. :-) nice script!
|
Thanks Ramurd.
What I found baffling was that I expected the get-pkgsize script to take longer than the simple awk one-liner because get-pkgsize is a gawk script in a shell-wrapper with which pipes output to sort then to another gawk script. Anyhow ... -- kjh(<G> it's not like the real delta-t's are significant in any case <G>) |
p.s. I use gawk every day for some serious data conversions( GB's of Data )
and I have found that the speed is close enough to perl's speed that I choose gawk over perl because I can use code-generators I've developed over the past 30-years :) |
Nice (g)awk kjhambrick.
Good to see someone use awk for something other than '{ print $1 }' for a change. |
Thanks mRgOBLIN !
I really do like gawk's syntax. It's quite capable of any text processing that I have ever thrown at it. I did figure out why get-pkgsize was so much faster than audriusk's original awk one-liner ... The get-pkgsize script invokes nextfile as soon as it finds the /^UNCOMPRESSED/ pattern in the stream OTOH, the awk one-liner scans the rest of each the files in /var/log/packages, looking for more instances of the pattern in each line. These are the times again. Note that the new one-liner with nextfile is about as fast as the grep pipeline. -- kjh p.s. not that the times of 0.02 secs vs 0.14 secs mean anything in the real world where the one-liner will be invoked :) Code:
# gnashley's fgrep suggestion: |
Quote:
Thankyou for the insightful investigation and explanation. Quote:
|
Quote:
Code:
rpm -qa --queryformat="%{size} %{name}-%{version}-%{release}\n" | sort -rn |
Quote:
|
And I wouldn't have had all the fun I had writing get-pkgsize :)
|
All times are GMT -5. The time now is 08:17 PM. |