emacs-devel
[Top][All Lists]
Advanced

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

Re: Why does not rgrep use "grep -r"?


From: David Kastrup
Subject: Re: Why does not rgrep use "grep -r"?
Date: Sun, 04 Nov 2007 19:59:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: David Kastrup <address@hidden>
>> Cc: Miles Bader <address@hidden>,  address@hidden,  address@hidden,  
>> address@hidden
>> Date: Sat, 03 Nov 2007 10:43:03 +0100
>> 
>> Totally warm cache:
>> 
>> address@hidden:/usr/local/texlive/2007$ time find -name \*.tex|xargs grep 
>> snort
>> ./texmf-dist/source/latex/ae/aesample.tex:and whooping and sneezing and 
>> snorting, that I could not hear myself think for
>> 
>> real    0m0.974s
>> user    0m0.372s
>> sys     0m0.536s
>> address@hidden:/usr/local/texlive/2007$ time grep -r  --include=\*.tex snort 
>> .
>> ./texmf-dist/source/latex/ae/aesample.tex:and whooping and sneezing and 
>> snorting, that I could not hear myself think for
>> 
>> real    0m1.225s
>> user    0m0.376s
>> sys     0m0.764s
>> [...]
>> On a warm cache, it is pretty much the same.
>
> Perhaps for the Linux filesystem, it is.  It looks as it's quite
> different on Windows:
>
> With warm cache:
>
> timep grep -r snort d:/gnu/gdb-CVS/src/gdb > nul
>
> real    00h00m03.171s
> user    00h00m00.234s
> sys     00h00m02.312s
>
> timep find d:/gnu/gdb-CVS/src/gdb -name "*.c" | xargs grep snort > nul
>
> real    00h00m03.921s
> user    00h00m00.015s
> sys     00h00m00.015s
>
> That's a 20% difference in elapsed time (the fact that user and sys
> are zero is just an artefact of the timep command implementation on
> Windows).

What sense is there in using commands doing something quite different?
The first searches all files, the second just a subset.

> With cold cache:
>
> timep grep -r snort d:/gnu/gdb-CVS/src/gdb > nul
>
> real    00h00m15.531s
> user    00h00m00.328s
> sys     00h00m03.140s
>
> timep find d:/gnu/gdb-CVS/src/gdb -name "*.c" | xargs grep snort > nul
>
> real    00h00m13.687s
> user    00h00m00.015s
> sys     00h00m00.078s
>
> That's 11%, a much smaller gain, and in the other direction.

How is this the other direction?  You mean the other direction from your
first test rather than the test using GNU/Linux?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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