A little speed up for awk

Andreas Hauser andy at splashground.de
Sat Oct 30 14:56:13 PDT 2004

dillon wrote @ Sat, 30 Oct 2004 14:39:15 -0700 (PDT):

Btw. the original To: was the maintainer, i don't appreciate
bestserv messing with my To: / CC: lines. I woudn't have been
so formal only talking to you guys :-P

>     Well, that's a fine little patch but I really doubt it will
>     make much of a dent in awk's performance.

The problem case that came up on irc:
jot -w DragonFly 5000 | /usr/bin/time awk '{x=x $0}'
was improved by around 25% but since gawk e.g. is
around 10 times faster it doesn't really matter.
Joerg indicates one true awk being faster in other situations
so this might just be a corner case. I'm not really into
awk and so i won't come up with with better real world cases.

>     If you really want to have a go at tracking down potential
>     performance issues I recommend first doing some side-by-side
>     comparisons between the old and new awk and then compiling
>     up the new awk with profiling (-pg) and seeing if there is
>     anything obvious in the profile output that could be fixed.
>     The issue is likely to be algorithmic in nature.

Ya, probably, like keeping the length of the string around in the Cell.
strcpy was the ruler of profiling, that's how i found it.
It was just a cheap shot.


More information about the Submit mailing list