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

Re: [PATCH 2/2] pack-objects: optimize "recency order"

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 27, 2011, 21:49 UTC
Message-ID
<CACBZZX6ZWOF=j-k8o-4NHmjS2HpyS+PmKjJh_QKevWurBf9pbA@mail.gmail.com>
In-Reply-To
<CACBZZX6Ss4jLtdrDhLUNKCUjEHjHHKzfv-LMkOyTPDhRUXm4sQ@mail.gmail.com>
On Thu, Oct 27, 2011 at 23:01, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 7 quoted lines
> I haven't dug into why this is but I'm pretty sure it's because this
> patch makes Git behave pathologically on repositories with a large
> amount of tags. git.git itself has ~27k revs / and ~450 tags, or a tag
> every ~60 revisions.
>
> Try it on e.g. a repository with a couple of hundred thousand revs and
> a tag every 10-20 revisions.

Actually it just seems slow in general, not just on repositories with a lot of tags, on linux-2.6.git with this patch:

    $ time ~/g/git/git-pack-objects --keep-true-parents
--honor-pack-keep --non-empty --all --reflog
--delta-base-offs</dev/null
/home/avar/g/linux-2.6/.git/objects/pack/.tmp-pack
    Counting objects: 2184059, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (338780/338780), done.
    130605d5b82492a38452b9bc7bddfb4a6ef0e942
    Writing objects: 100% (2184059/2184059), done.
    Total 2184059 (delta 1825129), reused 2184059 (delta 1825129)
    real    1m28.426s
    user    1m19.661s
    sys     0m3.008s
With it reverted:
    $ time ~/g/git/git-pack-objects --keep-true-parents
--honor-pack-keep --non-empty --all --reflog --delta-base-offset
</dev/null /home/avar/g/linux-2.6/.git/objects/pack/.tmp-pack
    Counting objects: 2184059, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (338780/338780), done.
    130605d5b82492a38452b9bc7bddfb4a6ef0e942
    Writing objects: 100% (2184059/2184059), done.
    Total 2184059 (delta 1825129), reused 2184059 (delta 1825129)
    real    0m50.152s
    user    0m45.367s
    sys     0m2.920s
And if you create a lot of tags:
    git log --pretty=%h | perl -lne 'chomp(my $sha = <>); print $sha
if $i++ % 10 == 0' | parallel "git tag test-tag-{} {}"
Resulting in:
    $ git rev-list HEAD | wc -l
    269514
    $ git tag -l | wc -l
    13733

This'll be the time with this patch reverted, i.e. almost exactly the same as with just ~250 tags:

    real    0m52.860s
    user    0m44.907s
    sys     0m3.172s

And with it applied, i.e. almost exactly the same as with just ~250 tags:

    real    1m29.080s
    user    1m21.825s
    sys     0m3.096s
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 10 of 14 in “For improved pack locality”
  1. 0/2 For improved pack localityJunio C Hamano, Jul 8, 2011
  2. 1/2 core: log offset pack data accesses happenedJunio C Hamano, Jul 8, 2011
  3. 2/2 pack-objects: optimize "recency order"Junio C Hamano, Jul 8, 2011
  4. Shawn PearceJul 8, 2011
  5. Junio C HamanoJul 8, 2011
  6. Nicolas PitreJul 11, 2011
  7. Junio C HamanoJul 8, 2011
  8. Shawn PearceJul 9, 2011
  9. Ævar Arnfjörð BjarmasonOct 27, 2011
  10. Ævar Arnfjörð BjarmasonOct 27, 2011
  11. Ævar Arnfjörð BjarmasonOct 27, 2011
  12. Jakub NarebskiOct 27, 2011
  13. Junio C HamanoOct 27, 2011
  14. Ævar Arnfjörð BjarmasonOct 28, 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.