Re: [dev] off topic - awk versions performance comparison

From: Jakub Lach <jakub_lach_AT_mailplus.pl>
Date: Thu, 12 Aug 2010 10:33:35 +0200

Joseph Xu <josephzxu_AT_gmail.com> wrote:

>I was using GNU tr. The input files were single lines
>with 10000 or 1000000 y's, so I was doing 100 matches
>in each case (from the for loop) on the same line. I guess
>I should have made that more explicit, sorry. I'm interested in
>what results you're getting.
 
$ yes | head -1000000 | tr -d '\n' >/tmp/big
$ yes | head -100000000 | tr -d '\n' >/tmp/bigger
$ time awk '{for (i=1; i < 100; i++) { match($0, "y")} }' /tmp/big
       0m0.10s real 0m0.06s user 0m0.01s system
$ time awk '{for (i=1; i < 100; i++) { match($0, "y")} }' /tmp/bigger
       0m3.89s real 0m2.44s user 0m1.43s system

FreeBSD 8.1-STABLE
Received on Thu Aug 12 2010 - 10:33:35 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 12 2010 - 10:36:02 CEST