[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vc-git-grep vs project-find-regexp
From: |
Philip Kaludercic |
Subject: |
Re: vc-git-grep vs project-find-regexp |
Date: |
Mon, 21 Aug 2023 18:51:59 +0000 |
Nicolás Ojeda Bär <n.oje.bar@gmail.com> writes:
> Hello,
>
> I have used M-x vc-git-grep for a long time, but decided to give M-x
> project-find-regexp a try after switching to 29.1.
>
> While it seems to work well, project-find-regexp seems much slower
> than vc-git-grep. After you execute the command, it pauses for what it
> feels a long time (~2s in a medium-size codebase) before showing the
> results. vc-git-grep on the other hand, starts displaying results
> immediately.
I suspect the reason is that in the former case, you are actually using
the "git grep" sub-command, that is more efficient, while
`project-find-regexp' defers to `xref-matches-in-files' and uses
`xref-search-program', which is set to regular "grep" by default. You
can try out the other available tools (ripgrep and ugrep) to see if it
might improve your performance?
> Is there a good reason for this difference? The only visible
> difference between both commands is that project-find-regexp's results
> are displayed in a XREF buffer while vc-git-grep uses Grep mode.
That shouldn't make much of a difference, the main bottle-neck here is
disk IO.
> Insights appreciated!
>
> Best wishes,
> Nicolas