[ On Wednesday, April 26, 2000 at 18:52:55 (-0700), Paul Eggert wrote: ]
> Subject: Re: Performances of awk
>
> It certainly is. This is a performance bug in mawk.
> I observed the bug in mawk 1.3.3.
>
> To work around the problem somewhat, please try replacing this:
>
> while (sub(/__oline__/, oline))
> continue
>
> with this:
>
> if ($0 ~ /__oline__/)
> while (sub(/__oline__/, oline))
> continue
While that doesn't do much for nawk or gawk (in fact it might even slow
them down a tiny bit), it does speed mawk back up enough that it's
faster than the other two again! ;-)
02:37 [106] $ time nawk -f ~/src/finalize.awk < amanda/configure > /dev/null
5.51s real 2.78s user 0.31s system
02:37 [107] $ time mawk -f ~/src/finalize.awk < amanda/configure > /dev/null
77.37s real 75.98s user 0.47s system
02:39 [108] $ time gawk -f ~/src/finalize.awk < amanda/configure > /dev/null
4.42s real 4.12s user 0.09s system
02:39 [109] $ time nawk -f ~/src/finalize-fast.awk < amanda/configure > /dev/null
2.96s real 2.80s user 0.10s system
02:39 [110] $ time mawk -f ~/src/finalize-fast.awk < amanda/configure > /dev/null
1.30s real 1.21s user 0.07s system
02:39 [111] $ time gawk -f ~/src/finalize-fast.awk < amanda/configure > /dev/null
4.39s real 4.18s user 0.16s system
I'm guessing that nawk and gawk may do this test automatically as an
optimisation internally....
--
Greg A. Woods
+1 416 218-0098 VE3TCP <[EMAIL PROTECTED]> <robohack!woods>
Planix, Inc. <[EMAIL PROTECTED]>; Secrets of the Weird <[EMAIL PROTECTED]>