From: Derrick Stolee <dstolee@microsoft.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: "peff@peff.net" <peff@peff.net>,
"sbeller@google.com" <sbeller@google.com>,
"jnareb@gmail.com" <jnareb@gmail.com>,
Derrick Stolee <dstolee@microsoft.com>
Subject: [RFC PATCH 00/13] Consolidate reachability logic
Date: Fri, 29 Jun 2018 16:12:35 +0000 [thread overview]
Message-ID: <20180629161223.229661-1-dstolee@microsoft.com> (raw)
This RFC is a bit unpolished because I was mostly seeing where the idea
could go. I wanted to achieve the following:
1. Consolidate several different commit walks into one file
2. Reduce duplicate reachability logic
3. Increase testability (correctness and performance)
4. Improve performance of reachability queries
My approach is mostly in three parts:
I. Move code to a new commit-reach.c file.
II. Add a 'test-tool reach' command to test these methods directly.
III. Modify the logic by improving performance and calling methods with
similar logic but different prototypes.
The 'test-tool reach' command is helpful to make sure I don't break
anything as I change the logic, but also so I can test methods that are
normally only exposed by other more complicated commands. For instance,
ref_newer() is part of 'git push -f' and ok_to_give_up() is buried deep
within fetch negotiation. Both of these methods have some problematic
performacne issues that are corrected by this series. As I discovered
them, it was clear that it would be better to consolidate walk logic
instead of discovering a new walk in another file hidden somewhere.
For the ok_to_give_up() method, I refactored the method so I could pull
the logic out of the depths of fetch negotiation. In the commit
"commit-reach: make can_all_from_reach... linear" I discuss how the
existing algorithm is quadratic and how we can make it linear. Also, we
can use heuristic knowledge about the shape of the commit graph and the
usual haves/wants to get some extra performance bonus. (The heuristic is
to do a DFS with first-parents first, and stop on first found result. We
expect haves/wants to include ref tips, which typically have their
previous values in their first-parent history.)
The "test-reach" commit in particular is not split well or described
well for mailing-list review. I figured I would send the RFC instead of
tweaking it carefully, because I will need to re-do most of these
changes after more of the object-store series is merged. I don't plan to
send a v1 patch until the lookup_commit() and parse_commit() code is
stable again.
Thanks,
-Stolee
Derrick Stolee (13):
commit-reach: move walk methods from commit.c
commit-reach: move ref_newer from remote.c
commit-reach: move commit_contains from ref-filter
upload-pack: make reachable() more generic
upload-pack: refactor ok_to_give_up()
commit-reach: move can_all_from_reach_with_flag()
test-reach
test-reach: test reduce_heads()
commit-reach: test can_all_from_reach
commit-reach: test is_descendant_of
commit-reach: make can_all_from_reach... linear
commit-reach: use is_descendant_of for ref_newer
commit-reach: use can_all_from_reach
Makefile | 2 +
builtin/remote.c | 1 +
commit-reach.c | 656 ++++++++++++++++++++++++++++++++++++++++++
commit-reach.h | 37 +++
commit.c | 365 +----------------------
commit.h | 6 +-
fast-import.c | 1 +
fetch-pack.c | 3 +-
http-push.c | 1 +
ref-filter.c | 147 +---------
remote.c | 48 +---
remote.h | 1 -
sha1-name.c | 3 +-
t/helper/test-reach.c | 128 +++++++++
t/helper/test-tool.c | 1 +
t/helper/test-tool.h | 1 +
t/t6600-test-reach.sh | 177 ++++++++++++
upload-pack.c | 58 +---
walker.c | 3 +-
19 files changed, 1035 insertions(+), 604 deletions(-)
create mode 100644 commit-reach.c
create mode 100644 commit-reach.h
create mode 100644 t/helper/test-reach.c
create mode 100755 t/t6600-test-reach.sh
base-commit: d4f65b8d141e041eb5e558cd9e763873e29863b9
--
2.18.0.118.gd4f65b8d14
next reply other threads:[~2018-06-29 16:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 16:12 Derrick Stolee [this message]
2018-06-29 16:12 ` [RFC PATCH 01/13] commit-reach: move walk methods from commit.c Derrick Stolee
2018-06-29 21:35 ` Stefan Beller
2018-06-29 21:52 ` Junio C Hamano
2018-06-29 16:12 ` [RFC PATCH 02/13] commit-reach: move ref_newer from remote.c Derrick Stolee
2018-06-29 16:12 ` [RFC PATCH 03/13] commit-reach: move commit_contains from ref-filter Derrick Stolee
2018-06-29 21:38 ` Stefan Beller
2018-06-30 1:32 ` Derrick Stolee
2018-06-29 22:00 ` Junio C Hamano
2018-06-29 16:12 ` [RFC PATCH 04/13] upload-pack: make reachable() more generic Derrick Stolee
2018-06-29 22:05 ` Junio C Hamano
2018-06-29 16:12 ` [RFC PATCH 05/13] upload-pack: refactor ok_to_give_up() Derrick Stolee
2018-06-29 21:44 ` Stefan Beller
2018-06-29 16:12 ` [RFC PATCH 06/13] commit-reach: move can_all_from_reach_with_flag() Derrick Stolee
2018-06-29 21:47 ` Stefan Beller
2018-06-30 1:35 ` Derrick Stolee
2018-06-29 16:12 ` [RFC PATCH 07/13] test-reach Derrick Stolee
2018-06-29 21:54 ` Stefan Beller
2018-06-30 1:40 ` Derrick Stolee
2018-06-29 16:12 ` [RFC PATCH 08/13] test-reach: test reduce_heads() Derrick Stolee
2018-06-29 22:06 ` Stefan Beller
2018-06-29 16:12 ` [RFC PATCH 09/13] commit-reach: test can_all_from_reach Derrick Stolee
2018-06-29 16:12 ` [RFC PATCH 10/13] commit-reach: test is_descendant_of Derrick Stolee
2018-06-29 16:13 ` [RFC PATCH 11/13] commit-reach: make can_all_from_reach... linear Derrick Stolee
2018-06-29 23:18 ` Stefan Beller
2018-06-29 16:13 ` [RFC PATCH 12/13] commit-reach: use is_descendant_of for ref_newer Derrick Stolee
2018-06-29 16:13 ` [RFC PATCH 13/13] commit-reach: use can_all_from_reach Derrick Stolee
2018-06-29 23:21 ` Stefan Beller
2018-06-29 17:33 ` [RFC PATCH 00/13] Consolidate reachability logic Derrick Stolee
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=20180629161223.229661-1-dstolee@microsoft.com \
--to=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=peff@peff.net \
--cc=sbeller@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.