Re: grep vs git grep performance?
- From
Stefan Beller <sbeller@google.com>
- Date
- Oct 26, 2017, 16:58 UTC
- Message-ID
- <CAGZ79ka41NdzNxGAvtVW802088KydKkp3yHx=Z5q3Mc9GGa_+g@mail.gmail.com>
- In-Reply-To
- <1509030170.10651.59.camel@perches.com>
+ Avar who knows a thing about pcre (I assume the regex compilation has impact on grep speed)
On Thu, Oct 26, 2017 at 8:02 AM, Joe Perches <joe@perches.com> wrote:
Show 19 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 >
I wonder how much is algorithmic advantage vs coding/micro optimization that we can do.