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

Re: [BAD PATCH 0/9] v4-aware tree walker API

From
Nicolas Pitre <nico@fluxnic.net>
Date
Oct 9, 2013, 16:51 UTC
Message-ID
<alpine.LFD.2.03.1310091137310.3023@syhkavp.arg>
In-Reply-To
<1381329976-32082-1-git-send-email-pclouds@gmail.com>
On Wed, 9 Oct 2013, Nguy�n Th�i Ng�c Duy wrote:
Show 7 quoted lines
> I know I still have a lot of holes to plug, but this was more
> interesting because we could see some encouraging numbers.
> Unfortunately the result is disappointing. Maybe I did it in a stupid
> way and need to restart with a totally different way.
> 
> "rev-list --objects" on v2 takes 4 secs, v4 with current walker 11s
> and the new walker 16s (worst!).

Clear indication that something is wrong if the intermediate step of converting to the canonical object representation is faster than your attempt at a native pv4 walker.

However here's the numbers I get here after a fresh clone of git.git
$ time git revlist --objects --all > /dev/null

real 0m2.619s user 0m2.577s sys 0m0.033s $ mkdir orig $ mv .git/objects/pack/pack-* orig/ $ ../../git/test-packv4 orig/pack-*.pack .git/objects/pack/pack-foo.pack Scanning objects: 100% (162785/162785), done. Writing objects: 100% (162785/162785), done. $ time git rev-list --objects --all > /dev/null

real 0m6.210s user 0m6.140s sys 0m0.027s

[installing git with your latest patches applied here]
$ time git rev-list --objects --all > /dev/null

real 0m20.409s user 0m20.337s sys 0m0.029s

So... I get even *worse* numbers relative to v2 than you do!
Now let's mitigate the deep delta chaining effect in the tree encoding:

$ rm .git/objects/pack/pack-foo.* $ ../../git/test-packv4 --min-tree-copy=50 orig/pack-*.pack .git/objects/pack/pack-foo.pack Scanning objects: 100% (162785/162785), done. Writing objects: 100% (162785/162785), done. $ time git rev-list --objects --all > /dev/null

real 0m9.451s user 0m9.393s sys 0m0.036s

Using --min-tree-copy=50 produces a pack which is still smaller than pack v2 but any tree copy sequence must refer to a minimum of 50 entries. This significantly reduces the CPU usage in decode_entries() by reducing the needless chaining effect I mentioned here:

http://article.gmane.org/gmane.comp.version-control.git/234975
Now let's keep that pack and back out your patches.
[installing git with your latest patches reverted here]
$ time git rev-list --objects --all > /dev/null

real 0m3.751s user 0m3.711s sys 0m0.029s

So I shoved almost 2.5 seconds of runtime here. Not the half of the original runtime, but still significant.

Let's push the chaining theory even further:

$ rm .git/objects/pack/pack-foo.* $ ../../git/test-packv4 --min-tree-copy=100 orig/pack-*.pack .git/objects/pack/pack-foo.pack Scanning objects: 100% (162785/162785), done. Writing objects: 100% (162785/162785), done. $ time git rev-list --objects --all > /dev/null

real 0m3.445s user 0m3.406s sys 0m0.029s

With --min-tree-copy=100 the resulting pack gets somewhat larger than the v2 equivalent, but still smaller if we take into account the size of both the pack and index files. However the runtime benefit is no more significant.

So, there are 2 conclusions here:
1: The current tree delta euristic is inefficient for pack v4.
2- Something must be very wrong in your latest patches as they make it
   close to 3 times more expensive than without them.
Show 5 quoted lines
> The only bit I haven't done is avoid checking if a tree is already
> examined, if so do not bother with copy sequences referring to it.
> That should cut down the number of decode_entries but not sure how
> much because there's no relation between tree traversing order and how
> copy sequences are made.
I'm sure it would help mitigate the deep delta chaining effect as well.
Show 5 quoted lines
> Maybe we could make an exception and allow the tree walker to pass
> pv4_tree_cache* directly to decode_entries so it does not need to do
> the first lookup every time..
> 
> Suggestions?
I'll try to have a look at your patches in more details soon.
Nicolas
Previous: Nguyễn Thái Ngọc DuyNext: Duy Nguyen
Message 11 of 15 in “v4-aware tree walker API”
  1. 0/9 v4-aware tree walker APINguyễn Thái Ngọc Duy, Oct 9, 2013
  2. 1/9 sha1_file: provide real packed type in object_info_extendedNguyễn Thái Ngọc Duy, Oct 9, 2013
  3. 2/9 pack v4: move v2 tree entry generation code out of decode_entriesNguyễn Thái Ngọc Duy, Oct 9, 2013
  4. 3/9 pv4_tree_desc: introduce new struct for pack v4 tree walkerNguyễn Thái Ngọc Duy, Oct 9, 2013
  5. 4/9 pv4_tree_desc: use struct tree_desc from pv4_tree_descNguyễn Thái Ngọc Duy, Oct 9, 2013
  6. 5/9 pv4_tree_desc: allow decode_entries to return v4 trees, one at a timeNguyễn Thái Ngọc Duy, Oct 9, 2013
  7. 6/9 pv4_tree_desc: complete interfaceNguyễn Thái Ngọc Duy, Oct 9, 2013
  8. 7/9 pv4_tree_desc: don't bother looking for v4 trees if no v4 packs are presentNguyễn Thái Ngọc Duy, Oct 9, 2013
  9. 8/9 pv4_tree_desc: avoid lookup_object() when possibleNguyễn Thái Ngọc Duy, Oct 9, 2013
  10. 9/9 list-object.c: take "advantage" of new pv4_tree_desc interfaceNguyễn Thái Ngọc Duy, Oct 9, 2013
  11. Nicolas PitreOct 9, 2013
  12. Duy NguyenOct 11, 2013
  13. Duy NguyenOct 11, 2013
  14. Nicolas PitreOct 12, 2013
  15. Duy NguyenOct 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.