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:34 UTC
Message-ID
<20141126013456.GA13622@peff.net>
In-Reply-To
<20141126012448.GA11183@peff.net>
On Tue, Nov 25, 2014 at 08:24:48PM -0500, Jeff King wrote:
Show 15 quoted lines
> However, this is not what trees created by git-notes look like. It
> shards the object sha1s into subtrees (1a/2b/{36}), and I think does so
> dynamically in a way that keeps each individual tree size low. The
> in-memory data structure then only "faults in" tree objects as they are
> needed. So a single lookup should only hit a small part of the total
> tree.
> 
> Doing a single "git notes edit HEAD" in my case caused the notes code to
> write the result using its sharding algorithm. Subsequent "git notes
> show" invocations were only 14ms.
> 
> Did you use something besides git-notes to create the tree? From your
> examples, it looks like you were accounting for the sharding during
> lookup, so maybe this is leading in the wrong direction (but if so, I
> could not reproduce your times at all even with a much larger case).

Hmph. Having just written all that, I looked at your example again, and you are running "git ls-tree -r", which would read the whole tree anyway. So "git notes" should be _faster_ for a single lookup.

Something weird is definitely going on. Can you use "strace" or "perf" to get a sense of where the time is going? Has your repository been packed recently?

-Peff
Previous: Jeff KingNext: Mike Hommey
Message 4 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.