Joseph Xu <joseph...@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

Reply via email to