git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to reduce pickaxe times for a particular repo?

From
Jeff King <peff@peff.net>
Date
Jul 1, 2022, 18:21 UTC
Message-ID
<Yr87Pt8/l2Tte/Gd@coredump.intra.peff.net>
In-Reply-To
<6439e948-ff79-9e10-97f5-378806e25b5b@github.com>
On Tue, Jun 28, 2022 at 09:01:17AM -0400, Derrick Stolee wrote:
Show 12 quoted lines
> > Typically, a `git log -S/-G` lookup takes around a minute to complete.
> > I would like to significantly reduce that time. How can I do that? I
> > can spend up to 10x more disk space, if required. The machine has 10
> > cores and 32GB of RAM.
> 
> You are using -S<string> or -G<regex> to see which commits change the
> number of matches of that <string> or <regex>. If you don't provide a
> pathspec, then Git will search every changed file, including those
> very large binary files.
> 
> Perhaps you'd like to start by providing a pathspec that limits the
> search to only the meaningful code files?

I think "-S" will search every file, since it's just counting instances of the token in each file. But "-G" does a diff first, so it skips binary files. So you could probably speed it up in general with a .gitattributes that mark large binary files as such. Sort of the same concept as your pathspec suggestion (which is a good one), but you don't have to remember to add it to each invocation. :)

-Peff
Previous: Derrick Stolee
Message 6 of 6 in “How to reduce pickaxe times for a particular repo?”
  1. Pavel RappoJun 28, 2022
  2. Ævar Arnfjörð BjarmasonJun 28, 2022
  3. Pavel RappoJun 28, 2022
  4. Ævar Arnfjörð BjarmasonJun 29, 2022
  5. Derrick StoleeJun 28, 2022
  6. Jeff KingJul 1, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.