From: Phillip Wood <phillip.wood123@gmail.com>
To: Victoria Dye via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Cc: gitster@pobox.com, phillip.wood123@gmail.com,
derrickstolee@github.com, jonathantanmy@google.com,
Taylor Blau <me@ttaylorr.com>, Victoria Dye <vdye@github.com>
Subject: Re: [PATCH v2 5/5] rebase: use 'skip_cache_tree_update' option
Date: Thu, 10 Nov 2022 14:40:22 +0000 [thread overview]
Message-ID: <44b0331a-17e5-1528-2249-e89f0bdd6ffb@dunelm.org.uk> (raw)
In-Reply-To: <fffe2fc17ed3beb05376f1377ea193199c13c657.1668045438.git.gitgitgadget@gmail.com>
Hi Victoria
On 10/11/2022 01:57, Victoria Dye via GitGitGadget wrote:
> From: Victoria Dye <vdye@github.com>
>
> Enable the 'skip_cache_tree_update' option in both 'do_reset()'
> ('sequencer.c') and 'reset_head()' ('reset.c'). Both of these callers invoke
> 'prime_cache_tree()' after 'unpack_trees()', so we can remove an unnecessary
> cache tree rebuild by skipping 'cache_tree_update()'.
>
> When testing with 'p3400-rebase.sh' and 'p3404-rebase-interactive.sh', the
> performance change of this update was negligible, likely due to the
> operation being dominated by more expensive operations (like checking out
> trees).
Yes, we only call this once at the beginning of the rebase and then for
any reset commands and the run time will be dominated by picking commits.
> However, since the change doesn't harm performance, it's worth
> keeping this 'unpack_trees()' usage consistent with others that subsequently
> invoke 'prime_cache_tree()'.
That makes sense
> Signed-off-by: Victoria Dye <vdye@github.com>
> ---
> reset.c | 1 +
> sequencer.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/reset.c b/reset.c
> index e3383a93343..5ded23611f3 100644
> --- a/reset.c
> +++ b/reset.c
> @@ -128,6 +128,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)
unpack_tree_opts.fn = reset_hard ? oneway_merge : twoway_merge;
> unpack_tree_opts.update = 1;
> unpack_tree_opts.merge = 1;
> unpack_tree_opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
> + unpack_tree_opts.skip_cache_tree_update = 1;
I've added an extra context line above to show that we do either a
one-way or two-way merge - is it safe to skip the cache_tree_update for
the two-way merge? (I'm afraid I seem to have forgotten everything I
learnt about prime_cache_tree() and cache_tree_update() when we
discussed this optimization before).
Best Wishes
Phillip
> init_checkout_metadata(&unpack_tree_opts.meta, switch_to_branch, oid, NULL);
> if (reset_hard)
> unpack_tree_opts.reset = UNPACK_RESET_PROTECT_UNTRACKED;
> diff --git a/sequencer.c b/sequencer.c
> index e658df7e8ff..3f7a73ce4e1 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -3750,6 +3750,7 @@ static int do_reset(struct repository *r,
> unpack_tree_opts.merge = 1;
> unpack_tree_opts.update = 1;
> unpack_tree_opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
> + unpack_tree_opts.skip_cache_tree_update = 1;
> init_checkout_metadata(&unpack_tree_opts.meta, name, &oid, NULL);
>
> if (repo_read_index_unmerged(r)) {
next prev parent reply other threads:[~2022-11-10 14:40 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 22:44 [PATCH 0/5] Skip 'cache_tree_update()' when 'prime_cache_tree()' is called immediate after Victoria Dye via GitGitGadget
2022-11-08 22:44 ` [PATCH 1/5] cache-tree: add perf test comparing update and prime Victoria Dye via GitGitGadget
2022-11-10 7:23 ` SZEDER Gábor
2022-11-08 22:44 ` [PATCH 2/5] unpack-trees: add 'skip_cache_tree_update' option Victoria Dye via GitGitGadget
2022-11-08 22:44 ` [PATCH 3/5] reset: use " Victoria Dye via GitGitGadget
2022-11-08 22:44 ` [PATCH 4/5] read-tree: " Victoria Dye via GitGitGadget
2022-11-08 22:44 ` [PATCH 5/5] rebase: " Victoria Dye via GitGitGadget
2022-11-09 15:23 ` [PATCH 0/5] Skip 'cache_tree_update()' when 'prime_cache_tree()' is called immediate after Derrick Stolee
2022-11-09 22:18 ` Victoria Dye
2022-11-10 14:44 ` Derrick Stolee
2022-11-09 23:01 ` Taylor Blau
2022-11-10 1:57 ` [PATCH v2 " Victoria Dye via GitGitGadget
2022-11-10 1:57 ` [PATCH v2 1/5] cache-tree: add perf test comparing update and prime Victoria Dye via GitGitGadget
2022-11-10 1:57 ` [PATCH v2 2/5] unpack-trees: add 'skip_cache_tree_update' option Victoria Dye via GitGitGadget
2022-11-10 1:57 ` [PATCH v2 3/5] reset: use " Victoria Dye via GitGitGadget
2022-11-10 1:57 ` [PATCH v2 4/5] read-tree: " Victoria Dye via GitGitGadget
2022-11-10 1:57 ` [PATCH v2 5/5] rebase: " Victoria Dye via GitGitGadget
2022-11-10 14:40 ` Phillip Wood [this message]
2022-11-10 18:19 ` Victoria Dye
2022-11-10 2:12 ` [PATCH v2 0/5] Skip 'cache_tree_update()' when 'prime_cache_tree()' is called immediate after Taylor Blau
2022-11-10 17:26 ` Derrick Stolee
2022-11-10 19:06 ` [PATCH v3 " Victoria Dye via GitGitGadget
2022-11-10 19:06 ` [PATCH v3 1/5] cache-tree: add perf test comparing update and prime Victoria Dye via GitGitGadget
2022-11-10 19:06 ` [PATCH v3 2/5] unpack-trees: add 'skip_cache_tree_update' option Victoria Dye via GitGitGadget
2022-11-10 19:06 ` [PATCH v3 3/5] reset: use " Victoria Dye via GitGitGadget
2022-11-10 19:06 ` [PATCH v3 4/5] read-tree: " Victoria Dye via GitGitGadget
2022-11-10 19:06 ` [PATCH v3 5/5] rebase: " Victoria Dye via GitGitGadget
2022-11-10 19:50 ` [PATCH v3 0/5] Skip 'cache_tree_update()' when 'prime_cache_tree()' is called immediate after SZEDER Gábor
2022-11-10 20:54 ` Victoria Dye
2022-11-11 2:50 ` Taylor Blau
2022-11-14 0:08 ` 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44b0331a-17e5-1528-2249-e89f0bdd6ffb@dunelm.org.uk \
--to=phillip.wood123@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=jonathantanmy@google.com \
--cc=me@ttaylorr.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=vdye@github.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).