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

git diff is slow (--patience is fast)

From
Marat Radchenko <marat@slonopotamus.org>
Date
Aug 9, 2011, 07:51 UTC
Message-ID
<loom.20110809T093124-847@post.gmane.org>
Warning, downloaded files are 7.5Mb each.
~ $ git --version
git version 1.7.6
~ $ mkdir tmp
~ $ cd tmp
~/tmp $ git init
Initialized empty Git repository in /home/marat/tmp/.git/
~/tmp $ wget http://slonopotamus.org/git-diff/foo 2> /dev/null 
~/tmp $ git add -A
~/tmp $ git commit -am "initial"
[master (root-commit) 6b68e83] initial
 1 files changed, 410461 insertions(+), 0 deletions(-)
 create mode 100644 foo
~/tmp $ wget http://slonopotamus.org/git-diff/foo2 -O foo 2> /dev/null 
~/tmp $ time git diff > /dev/null 

real 0m6.513s user 0m6.490s sys 0m0.020s ~/tmp $ time git diff --patience > /dev/null

real 0m0.237s user 0m0.180s sys 0m0.050s

Could something be done to `git diff` speed? I would be happy with patience diff, but other git commands call standard diff algorithm internally without giving an option to choose patience.

gprof output against git master: http://slonopotamus.org/git-diff/gmon.txt

Next: Tay Ray Chuan
Message 1 of 16 in “git diff is slow (--patience is fast)”
  1. Marat RadchenkoAug 9, 2011
  2. Tay Ray ChuanAug 9, 2011
  3. Marat RadchenkoAug 9, 2011
  4. Tay Ray ChuanAug 16, 2011
  5. xdiff/xprepare: improve O(n*m) performance in xdl_cleanup_records()Tay Ray Chuan, Aug 16, 2011
  6. Tay Ray ChuanAug 16, 2011
  7. Junio C HamanoAug 16, 2011
  8. xdiff/xprepare: improve O(n*m) performance in xdl_cleanup_records()Tay Ray Chuan, Aug 17, 2011
  9. Jeff KingAug 17, 2011
  10. Tay Ray ChuanAug 17, 2011
  11. Jeff KingAug 18, 2011
  12. Tay Ray ChuanAug 19, 2011
  13. Johannes SixtAug 21, 2011
  14. Marat RadchenkoAug 24, 2011
  15. Marat RadchenkoAug 24, 2011
  16. Marat RadchenkoAug 27, 2011

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.