git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 9/9] clone: run check_everything_connected
Date: Sun, 31 Mar 2013 14:57:12 +0700	[thread overview]
Message-ID: <20130331075712.GA13136@lanh> (raw)
In-Reply-To: <CACsJy8BMfYnFv=PL8x5JOMkjYc39h630oNEdukkjmBKBTNCibg@mail.gmail.com>

On Thu, Mar 28, 2013 at 07:40:51AM +0700, Duy Nguyen wrote:
> Maybe we could do it in index-pack to save some (wall) time. I haven't
> tried but I think it might work. The problem is to make sure the pack
> contains objects for all sha1 references in the pack. By that
> description, we don't need to do standard DAG traversal. We could
> extract sha-1 references in index-pack as we uncompress objects and
> put all "want" sha-1 in a hash table. At the end of index-pack, we
> check if any sha-1 in the hash table still points to non-existing
> object.
> 
> This way, at least we don't need to uncompress all objects again in
> rev-list. We could parse+hash in both phases in index-pack. The first
> phase (parse_pack_objects) is usually I/O bound, we could hide some
> cost there. The second phase is multithreaded, all the better.

It looks like what I describe above is exactly what index-pack
--strict does. Except that it holds the lock longer and has more
abstraction layers to slow things down. On linux-2.6 with 3 threads:

$ rev-list --all --objects --quiet (aka check_everything_connected)
34.26user 0.22system 0:34.56elapsed 99%CPU (0avgtext+0avgdata 2550528maxresident)k
0inputs+0outputs (0major+208569minor)pagefaults 0swaps

$ index-pack --stdin
214.57user 8.38system 1:31.82elapsed 242%CPU (0avgtext+0avgdata 1357328maxresident)k
8inputs+1421016outputs (0major+1222537minor)pagefaults 0swaps

$ index-pack --stdin --strict
297.36user 13.77system 2:11.82elapsed 236%CPU (0avgtext+0avgdata 1875040maxresident)k
0inputs+1421016outputs (0major+1308718minor)pagefaults 0swaps

$ index-pack --stdin --connectivity
231.09user 7.42system 1:37.39elapsed 244%CPU (0avgtext+0avgdata 2080816maxresident)k
0inputs+1421016outputs (0major+540069minor)pagefaults 0swaps

The last one does not hold locks by duplicating object hash table per
thread. As you can see the consumed memory is much higher than --stdin.
In return it only adds up 1/3 of rev-list time.

Maybe you should check which one is cheaper for clone case,
check_everything_connected() or index-pack --strict.
--
Duy

      reply	other threads:[~2013-03-31  7:57 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-24 18:31 propagating repo corruption across clone Jeff King
2013-03-24 19:01 ` Ævar Arnfjörð Bjarmason
2013-03-24 19:23   ` Jeff King
2013-03-25 13:43     ` Jeff Mitchell
2013-03-25 14:56       ` Jeff King
2013-03-25 15:31         ` Duy Nguyen
2013-03-25 15:56           ` Jeff King
2013-03-25 16:32             ` Jeff Mitchell
2013-03-25 20:07               ` Jeff King
2013-03-26 13:43                 ` Jeff Mitchell
2013-03-26 16:55                   ` Jeff King
2013-03-26 21:59                     ` Philip Oakley
2013-03-26 22:03                       ` Jeff King
2013-03-26 23:20                     ` Rich Fromm
2013-03-27  1:25                       ` Jonathan Nieder
2013-03-27 18:23                         ` Rich Fromm
2013-03-27 19:49                           ` Jeff King
2013-03-27 20:04                             ` Jeff King
2013-03-27  3:47                       ` Junio C Hamano
2013-03-27  6:19                         ` Sitaram Chamarty
2013-03-27 15:03                           ` Junio C Hamano
2013-03-27 15:47                             ` Sitaram Chamarty
2013-03-27 18:51                         ` Rich Fromm
2013-03-27 19:13                           ` Junio C Hamano
2013-03-28 13:52                           ` Jeff Mitchell
2013-03-28 13:48                         ` Jeff Mitchell
2013-03-26  1:06             ` Duy Nguyen
2013-03-24 19:16 ` Ilari Liusvaara
2013-03-25 20:01 ` Junio C Hamano
2013-03-25 20:05   ` Jeff King
2013-03-25 20:14 ` [PATCH 0/9] corrupt object potpourri Jeff King
2013-03-25 20:16   ` [PATCH 1/9] stream_blob_to_fd: detect errors reading from stream Jeff King
2013-03-26 21:27     ` Junio C Hamano
2013-03-25 20:17   ` [PATCH 2/9] check_sha1_signature: check return value from read_istream Jeff King
2013-03-25 20:18   ` [PATCH 3/9] read_istream_filtered: propagate read error from upstream Jeff King
2013-03-25 20:21   ` [PATCH 4/9] avoid infinite loop in read_istream_loose Jeff King
2013-03-25 20:21   ` [PATCH 5/9] add test for streaming corrupt blobs Jeff King
2013-03-25 21:10     ` Jonathan Nieder
2013-03-25 21:26       ` Jeff King
2013-03-27 20:27     ` Jeff King
2013-03-27 20:35       ` Junio C Hamano
2013-03-25 20:22   ` [PATCH 6/9] streaming_write_entry: propagate streaming errors Jeff King
2013-03-25 21:35     ` Eric Sunshine
2013-03-25 21:37       ` Jeff King
2013-03-25 21:39     ` Jonathan Nieder
2013-03-25 21:49       ` [PATCH v2 " Jeff King
2013-03-25 23:29         ` Jonathan Nieder
2013-03-26 21:38         ` Junio C Hamano
2013-03-25 20:22   ` [PATCH 7/9] add tests for cloning corrupted repositories Jeff King
2013-03-25 20:23   ` [PATCH 8/9] clone: die on errors from unpack_trees Jeff King
2013-03-26 21:40     ` Junio C Hamano
2013-03-26 22:22       ` [PATCH 10/9] clone: leave repo in place after checkout errors Jeff King
2013-03-26 22:32         ` Jonathan Nieder
2013-03-27  1:03           ` Jeff King
2013-03-25 20:26   ` [PATCH 9/9] clone: run check_everything_connected Jeff King
2013-03-26  0:53     ` Duy Nguyen
2013-03-26 22:24       ` Jeff King
2013-03-26 21:50     ` Junio C Hamano
2013-03-28  0:40     ` Duy Nguyen
2013-03-31  7:57       ` Duy Nguyen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130331075712.GA13136@lanh \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).