Re: grep vs git grep performance?
- From
Joe Perches <joe@perches.com>
- Date
- Oct 26, 2017, 16:20 UTC
- Message-ID
- <1509034857.11245.4.camel@perches.com>
- In-Reply-To
- <20171026161354.23037-1-szeder.dev@gmail.com>
On Thu, 2017-10-26 at 18:13 +0200, SZEDER Gábor wrote:
Show 26 quoted lines
> > Comparing a cache warm git grep vs command line grep > > shows significant differences in cpu & wall clock. > > > > Any ideas how to improve this? > > > > $ time git grep "\bseq_.*%p\W" | wc -l > > 112 > > > > real 0m4.271s > > user 0m15.520s > > sys 0m0.395s > > > > $ time grep -r --include=*.[ch] "\bseq_.*%p\W" * | wc -l > > 112 > > > > real 0m1.164s > > user 0m0.847s > > sys 0m0.314s > > Note that this "regular" grep is limited to *.c and *.h files, while > the above git grep invocation isn't and has to look at all tracked > files. How does > > git grep "\bseq_.*%p\W" "*.[ch]" > > fare?
Same-ish
$ time git grep "\bseq_.*%p\W" -- "*.[ch]" | wc -l 112
real 0m4.225s user 0m14.485s sys 0m0.413s