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

Benchmarking git-add vs git-ls-files+update-index (was: way to automatically add untracked files?)

From
David Kastrup <dak@gnu.org>
Date
Aug 5, 2007, 10:33 UTC
Message-ID
<85vebu9sot.fsf_-_@lola.goethe.zz>
In-Reply-To
<85fy2ycu7n.fsf@lola.goethe.zz>
David Kastrup <dak@gnu.org> writes:
Show 16 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Linus Torvalds <torvalds@linux-foundation.org> writes:
>>
>>> ... (except, as we found out last week, we've had a huge 
>>> performance regression, so that's actually a really slow way to do it, and 
>>> so it's actually faster to do
>>>
>>> 	git ls-files -o | git update-index --add --stdin
>>> 	git commit -a
>>>
>>> instead...
>>
>> Is it still the case after the fix in rc4?  Other than the
>> theoretical "on multi-core, ls-files and update-index can run in
>> parallel" performance boost potential,

dak@lola:/home/tmp/texlive$ git-init Initialized empty Git repository in .git/ dak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist add .

real 9m36.256s user 2m2.408s sys 0m25.874s dak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist add .

real 0m34.161s user 0m0.448s sys 0m2.212s

[So the rc4 fix seems to have made it.]

dak@lola:/home/tmp/texlive$ rm -rf .git;git-init Initialized empty Git repository in .git/

dak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist ls-files -z -m -o .|(cd /usr/local/texlive/2007/texmf-dist;git --git-dir=/home/tmp/texlive/.git update-index --add -z --stdin)

real 8m9.370s user 2m1.172s sys 0m25.138s dak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist ls-files -z -m -o .|(cd /usr/local/texlive/2007/texmf-dist;git --git-dir=/home/tmp/texlive/.git update-index --add -z --stdin)

real 6m4.447s user 0m16.801s sys 0m12.333s dak@lola:/home/tmp/texlive$

[Hm.  Maybe "modified" files are not what I think they are?]
dak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist ls-files -z -o .|(cd /usr/local/texlive/2007/texmf-dist;git --git-dir=/home/tmp/texlive/.git update-index --add -z --stdin)

real 6m0.120s user 0m16.977s sys 0m12.653s

[No, doesn't help.]

[Just for kicks, let's try getting the Linux scheduler out of our hair in the initial case.]

dak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist ls-files -z -m -o .|dd bs=8k|(cd /usr/local/texlive/2007/texmf-dist;git --git-dir=/home/tmp/texlive/.git update-index --add -z --stdin) 201+1 records in 201+1 records out 1650230 bytes (1.7 MB) copied, 513.125 seconds, 3.2 kB/s

real 8m45.088s user 2m2.052s sys 0m25.870s

[Hm, does more damage than it helps.]

So in summary: git-ls-files -m is apparently lacking the optimization of git-add for unchanged inodes. Bad. Using it together with git-update-index in the initial case saves some time over git-add, but not breathtakingly so. This is on a single core.

Most of the time is spent waiting for I/O. Threaded execution should supposedly help in having less waiting time, but at least in this combination, the payoff does not seem overwhelming.

One should mention that the stuff I tested it on is actually sitting on a reiserfs file system (though the repository is on ext3).

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Previous: David KastrupNext: Miles Bader
Message 38 of 40 in “way to automatically add untracked files?”
  1. Miles BaderAug 5, 2007
  2. Shawn O. PearceAug 5, 2007
  3. Junio C HamanoAug 5, 2007
  4. Miles BaderAug 5, 2007
  5. Shawn O. PearceAug 5, 2007
  6. Miles BaderAug 5, 2007
  7. Junio C HamanoAug 5, 2007
  8. Miles BaderAug 5, 2007
  9. Junio C HamanoAug 5, 2007
  10. Miles BaderAug 5, 2007
  11. Junio C HamanoAug 5, 2007
  12. Miles BaderAug 5, 2007
  13. Johannes SchindelinAug 5, 2007
  14. Miles BaderAug 5, 2007
  15. Steffen ProhaskaAug 5, 2007
  16. Johan HerlandAug 5, 2007
  17. David KastrupAug 5, 2007
  18. Theodore TsoAug 5, 2007
  19. Johan HerlandAug 5, 2007
  20. Miles BaderAug 6, 2007
  21. Johannes SchindelinAug 6, 2007
  22. Miles BaderAug 6, 2007
  23. Johannes SchindelinAug 6, 2007
  24. Miles BaderAug 6, 2007
  25. Johan HerlandAug 6, 2007
  26. Johannes SchindelinAug 6, 2007
  27. Steffen ProhaskaAug 5, 2007
  28. Johannes SchindelinAug 6, 2007
  29. Steffen ProhaskaAug 6, 2007
  30. Jakub NarebskiAug 6, 2007
  31. Johan HerlandAug 6, 2007
  32. Junio C HamanoAug 6, 2007
  33. David KastrupAug 6, 2007
  34. Miles BaderAug 7, 2007
  35. Linus TorvaldsAug 5, 2007
  36. Junio C HamanoAug 5, 2007
  37. David KastrupAug 5, 2007
  38. Benchmarking git-add vs git-ls-files+update-index (was: way to automatically add untracked files?)David Kastrup, Aug 5, 2007
  39. Miles BaderAug 5, 2007
  40. Linus TorvaldsAug 5, 2007

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.