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

Serious performance regression in diff between 1.6.6 and 1.7.0

From
Brian Downing <bdowning@lavos.net>
Date
Jun 10, 2010, 00:10 UTC
Message-ID
<20100610001005.GA2635@glaurung.lavos.net>

I've stumbled across a pretty serious performance regression in "git diff" for a large (187456 files checked out on HEAD) repository of mine.

I bisected it and the first slow commit is:
commit 730f72840cc50c523fe4cdd796ea2d2fc4571a28
Author: Junio C Hamano <gitster@pobox.com>
Date:   Sun Sep 20 00:03:39 2009 -0700
    unpack-trees.c: look ahead in the index
    This makes the traversal of index be in sync with the tree traversal.
    When unpack_callback() is fed a set of tree entries from trees, it
    inspects the name of the entry and checks if the an index entry with
    the same name could be hiding behind the current index entry, and
    ...
It is more than 10x worse for my case here:

before 730f72840cc50c523fe4cdd796ea2d2fc4571a28: :; /usr/bin/time ~/src/git/git-diff HEAD >/dev/null 0.30user 0.50system 0:00.81elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+30119minor)pagefaults 0swaps

730f72840cc50c523fe4cdd796ea2d2fc4571a28: :; /usr/bin/time ~/src/git/git-diff HEAD >/dev/null 5.58user 0.40system 0:05.98elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+30117minor)pagefaults 0swaps

Unfortunately this pushes everyday use past my pain threshold for this repository. (As a sidenote, it's amazing how much Git has adjusted my pain threshold since the days of CVS!)

Is there any chance of algorithmic improvements to this fix to gain some of this speed back, or am I stuck with this when using newer Git?

-bcd
Next: Brian Downing
Message 1 of 6 in “Serious performance regression in diff between 1.6.6 and 1.7.0”
  1. Brian DowningJun 10, 2010
  2. Brian DowningJun 10, 2010
  3. Brian DowningJun 10, 2010
  4. Brian DowningJun 10, 2010
  5. unpack-trees: Make index lookahead less pessimalBrian Downing, Jun 11, 2010
  6. Junio C HamanoJun 11, 2010

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.