bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep is horribly slow


From: Stephane Chazelas
Subject: Re: grep is horribly slow
Date: Fri, 5 Oct 2007 16:26:09 +0100
User-agent: Mutt/1.5.16 (2007-06-11)

On Thu, Oct 04, 2007 at 10:14:39PM +0200, Rafal Dabrowa wrote:
> Grep appears to be horribly slow. See:
>
>     $ yes | head -5000 >file
>     $ ls -l file
>     -rw-r--r-- 1 rafal rafal 10000 2007-10-04 22:02 file
>     $ time grep y file >out
>
>     real      0m2.378s
>     user      0m2.376s
>     sys       0m0.004s
>     $ time sed -n '/y/p' file >out
>
>     real      0m0.008s
>     user      0m0.008s
>     sys       0m0.000s
>     $ grep --version
>     GNU grep 2.5.3
>
> Over 2 seconds for scanning a ~10 kB file ?
[...]

That's an already known issue in multibyte locales. See 
http://savannah.gnu.org/bugs/?14472
http://savannah.gnu.org/bugs/?21001

When grepping some non-multibyte text, such as the output of
yes, until that issue is resolved, you can temporaly switch back
to a non-utf8 locale.

LC_ALL=C grep y file > out

-- 
Stéphane




reply via email to

[Prev in Thread] Current Thread [Next in Thread]