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

[PATCH 0/7] cat-file --batch-check performance improvements

From
Jeff King <peff@peff.net>
Date
Jul 12, 2013, 06:15 UTC
Message-ID
<20130712061533.GA11297@sigill.intra.peff.net>

In my earlier series introducing "git cat-file --batch-check=<format>", found here:

  http://thread.gmane.org/gmane.comp.version-control.git/229761/focus=230041

I spent a little time optimizing revindex generation, and measured by requesting information on a single object from a large repository. This series takes the next logical step: requesting a large number of objects from a large repository.

There are two major optimizations here:
  1. Avoiding extra ref lookups due to the warning in 798c35f (get_sha1:
     warn about full or short object names that look like refs,
     2013-05-29).
  2. Avoiding extra work for delta type resolution when the user has not
     asked for %(objecttype).

I prepared the series on top of jk/in-pack-size-measurement, and certainly optimization 2 is pointless without it (before that topic, --batch-check always printed the type).

However, the first optimization affects regular --batch-check, and represents a much more serious performance regression. It looks like 798c35f is in master, but hasn't been released yet, so assuming these topics graduate before the next release, it should be OK. But if not, we should consider pulling the first patch out and applying it (or something like it) separately.

The results for running (in linux.git):
  $ git rev-list --objects --all >objects
  $ git cat-file --batch-check='%(objectsize:disk)' <objects >/dev/null
are:
        before     after
  real  1m17.143s  0m7.205s
  user  0m27.684s  0m6.580s
  sys   0m49.320s  0m0.608s

Now, _most_ of that speedup is coming from the first patch, and it's quite trivial. The rest of the patches involve a lot of refactoring, and only manage to eke out one more second of performance, so it may not be worth it (though I think the result actually cleans up the sha1_object_info_extended interface a bit, and is worth it). Individual timings are in the commit messages.

The patches are:
  [1/7]: cat-file: disable object/refname ambiguity check for batch mode
Optimization 1.
  [2/7]: sha1_object_info_extended: rename "status" to "type"
  [3/7]: sha1_loose_object_info: make type lookup optional
  [4/7]: packed_object_info: hoist delta type resolution to helper
  [5/7]: packed_object_info: make type lookup optional
  [6/7]: sha1_object_info_extended: make type calculation optional
Optimization 2.
  [7/7]: sha1_object_info_extended: pass object_info to helpers
Optional cleanup.
-Peff
Next: Jeff King
Message 1 of 16 in “cat-file --batch-check performance improvements”
  1. 0/7 cat-file --batch-check performance improvementsJeff King, Jul 12, 2013
  2. 1/7 cat-file: disable object/refname ambiguity check for batch modeJeff King, Jul 12, 2013
  3. Michael HaggertyJul 12, 2013
  4. Jeff KingJul 12, 2013
  5. Michael HaggertyJul 12, 2013
  6. Jeff KingJul 15, 2013
  7. Junio C HamanoJul 15, 2013
  8. Jeff KingJul 15, 2013
  9. 2/7 sha1_object_info_extended: rename "status" to "type"Jeff King, Jul 12, 2013
  10. 3/7 sha1_loose_object_info: make type lookup optionalJeff King, Jul 12, 2013
  11. 4/7 packed_object_info: hoist delta type resolution to helperJeff King, Jul 12, 2013
  12. 5/7 packed_object_info: make type lookup optionalJeff King, Jul 12, 2013
  13. 6/7 sha1_object_info_extended: make type calculation optionalJeff King, Jul 12, 2013
  14. 7/7 sha1_object_info_extended: pass object_info to helpersJeff King, Jul 12, 2013
  15. Junio C HamanoJul 12, 2013
  16. Jeff KingJul 12, 2013

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.