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

Re: "git notes show" is orders of magnitude slower than doing it manually with ls-tree and cat-file

From
Jeff King <peff@peff.net>
Date
Nov 26, 2014, 01:00 UTC
Message-ID
<20141126010051.GA29830@peff.net>
In-Reply-To
<20141126004242.GA13915@glandium.org>
On Wed, Nov 26, 2014 at 09:42:42AM +0900, Mike Hommey wrote:
Show 9 quoted lines
> I have a note tree with a bit more than 200k notes.
>
> $ time git notes --ref foo show $sha1 > /dev/null
> real    0m0.147s
> user    0m0.136s
> sys     0m0.008s
> 
> That's a lot of time, especially when you have a script that does that
> on a fair amount of sha1s.

IIRC, the notes code populates an in-memory data structure, which gives faster per-commit lookup at the cost of some setup time. Obviously for a single lookup, that's going to be a bad tradeoff (but it does make sense for "git log --notes"). I don't know offhand how difficult it would be to tune the data structure differently (or avoid it altogether) if we know ahead of time we are only going to do a small number of lookups. But Johan (cc'd) might.

-Peff
Previous: Mike HommeyNext: Jeff King
Message 2 of 10 in “"git notes show" is orders of magnitude slower than doing it manually with ls-tree and cat-file”
  1. Mike HommeyNov 26, 2014
  2. Jeff KingNov 26, 2014
  3. Jeff KingNov 26, 2014
  4. Jeff KingNov 26, 2014
  5. Mike HommeyNov 26, 2014
  6. Jeff KingNov 26, 2014
  7. Mike HommeyNov 26, 2014
  8. Jeff KingNov 26, 2014
  9. Johan HerlandNov 26, 2014
  10. Mike HommeyNov 26, 2014

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.