git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: [PATCH v2 2/3] index-pack: eliminate recursion in find_unresolved_deltas
Date: Tue, 10 Jan 2012 19:23:47 +0700	[thread overview]
Message-ID: <CACsJy8Cz-qWs2wrOYTjDMPjJH0wRQCFy9u6OFVPzn6YV0a6WaQ@mail.gmail.com> (raw)
In-Reply-To: <7vzkdwcys4.fsf@alter.siamese.dyndns.org>

2012/1/10 Junio C Hamano <gitster@pobox.com>:
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>
> I find both the original and the updated code rather dense to read without
> annotation, but from a cursory look all changes look good.

Maybe I stared at it for too long it seems obvious to me (hence no
further description in commit message). Let me describe it (and put in
commit message later if it makes sense)

Current code already links all bases together in a form of tree, using
struct base_data, with prev_base pointer to point to parent node. The
only problem is that struct base_data is all allocated on stack. So we
need to put all on heap (parse_pack_objects and
fix_unresolved_deltas). After that, it's simple depth-first traversal
where each node also maintains its own state (ofs and ref indices to
iterate over all children nodes).

So we process one node:

 - if it returns a new (child) node (a parent base), we link it to our
tree, then process the new node.
 - if it returns nothing, the node is done, free it. We go back to
parent node and resume whatever it's doing.

and do it until we have no nodes to process.
-- 
Duy

  reply	other threads:[~2012-01-10 12:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-26 12:04 [PATCH 1/3] Eliminate recursion in setting/clearing marks in commit list Nguyễn Thái Ngọc Duy
2011-12-26 12:04 ` [PATCH 2/3] index-pack: eliminate recursion in find_unresolved_deltas Nguyễn Thái Ngọc Duy
2011-12-26 12:04 ` [PATCH 3/3] index-pack: eliminate unlimited recursion in get_delta_base() Nguyễn Thái Ngọc Duy
2012-01-09  3:59 ` [PATCH v2 0/3] nd/index-pack-no-recurse Nguyễn Thái Ngọc Duy
2012-01-09 19:30   ` Junio C Hamano
2012-01-14 12:19   ` [PATCH v3 " Nguyễn Thái Ngọc Duy
2012-01-14 12:19     ` [PATCH v3 1/3] Eliminate recursion in setting/clearing marks in commit list Nguyễn Thái Ngọc Duy
2012-01-14 15:23       ` Peter Baumann
2012-01-15  9:25         ` Nguyen Thai Ngoc Duy
2012-01-14 12:19     ` [PATCH v3 2/3] index-pack: eliminate recursion in find_unresolved_deltas Nguyễn Thái Ngọc Duy
2012-01-14 12:19     ` [PATCH v3 3/3] index-pack: eliminate unlimited recursion in get_base_data() Nguyễn Thái Ngọc Duy
2012-01-09  3:59 ` [PATCH v2 1/3] Eliminate recursion in setting/clearing marks in commit list Nguyễn Thái Ngọc Duy
2012-01-09 22:09   ` Junio C Hamano
2012-01-09  3:59 ` [PATCH v2 2/3] index-pack: eliminate recursion in find_unresolved_deltas Nguyễn Thái Ngọc Duy
2012-01-09 22:10   ` Junio C Hamano
2012-01-10 12:23     ` Nguyen Thai Ngoc Duy [this message]
2012-01-12 20:32       ` Junio C Hamano
2012-01-09  3:59 ` [PATCH v2 3/3] index-pack: eliminate unlimited recursion in get_delta_base() Nguyễn Thái Ngọc Duy
2012-01-09 22:51   ` Junio C Hamano
2012-01-10 13:03     ` Nguyen Thai Ngoc Duy
2012-01-10 13:16       ` Nguyen Thai Ngoc Duy

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=CACsJy8Cz-qWs2wrOYTjDMPjJH0wRQCFy9u6OFVPzn6YV0a6WaQ@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=spearce@spearce.org \
    /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).