From: Patrick Steinhardt <ps@pks.im>
To: Toon Claes <toon@iotcl.com>
Cc: git@vger.kernel.org, Gusted <gusted@codeberg.org>,
Jeff King <peff@peff.net>, Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH v4 6/6] last-modified: keep per-path Bloom filters for wildcard pathspecs
Date: Thu, 10 Sep 2026 09:04:42 +0200 [thread overview]
Message-ID: <aqJWihcFmX7tPio5@pks.im> (raw)
In-Reply-To: <20260901-toon-speed-up-last-modified-v4-6-a09949800404@iotcl.com>
On Tue, Sep 01, 2026 at 11:10:26AM +0200, Toon Claes wrote:
> diff --git a/builtin/last-modified.c b/builtin/last-modified.c
> index 8ab7944314..bedccb3ace 100644
> --- a/builtin/last-modified.c
> +++ b/builtin/last-modified.c
> @@ -370,6 +375,14 @@ static int last_modified_run(struct last_modified *lm)
>
> prepare_revision_walk(&lm->rev);
>
> + /*
> + * prepare_revision_walk() clears bloom_filter_settings for pathspecs
> + * without a Bloom key. Restore it so the per-path check keeps working.
> + */
> + if (!lm->rev.bloom_filter_settings)
> + lm->rev.bloom_filter_settings =
> + get_bloom_filter_settings(lm->rev.repo);
> +
> max_count = lm->rev.max_count;
>
> init_active_paths_for_commit(&lm->active_paths);
So the revision subsystem is unhappy, but we basically force the bloom
filter settings in there anyway? That feels a bit fragile to me. Is
there a reason why the revision machinery itself specifically needs to
have the bloom filters populated, or do we basically just have to set up
the bloom filters so that we can access them ourselves?
If the latter, can't we instead store the bloom filter settings in
`struct last_modified` instead of forcing them into the revision
machinery? Something like the below patch on top of tihs, which still
passes all of our tests.
There might be good reasons though why we can't do it this way.
Patrick
diff --git a/builtin/last-modified.c b/builtin/last-modified.c
index bedccb3ace..dabd0b7c34 100644
--- a/builtin/last-modified.c
+++ b/builtin/last-modified.c
@@ -58,6 +58,8 @@ struct last_modified {
bool nul_termination;
int max_depth;
+ struct bloom_filter_settings *bloom_filter_settings;
+
const char **all_paths;
size_t all_paths_nr;
struct active_paths_for_commit active_paths;
@@ -117,9 +119,9 @@ static void add_path_from_diff(struct diff_queue_struct *q,
FLEX_ALLOC_STR(ent, path, path);
oidcpy(&ent->oid, &p->two->oid);
- if (lm->rev.bloom_filter_settings)
+ if (lm->bloom_filter_settings)
bloom_key_fill(&ent->key, path, strlen(path),
- lm->rev.bloom_filter_settings);
+ lm->bloom_filter_settings);
hashmap_entry_init(&ent->hashent, strhash(ent->path));
hashmap_add(&lm->paths, &ent->hashent);
}
@@ -265,7 +267,7 @@ static bool maybe_changed_path(struct last_modified *lm,
struct last_modified_entry *ent;
struct hashmap_iter iter;
- if (!lm->rev.bloom_filter_settings)
+ if (!lm->bloom_filter_settings)
return true;
if (commit_graph_generation(origin) == GENERATION_NUMBER_INFINITY)
@@ -294,7 +296,7 @@ static bool maybe_changed_path(struct last_modified *lm,
continue;
if (bloom_filter_contains(filter, &ent->key,
- lm->rev.bloom_filter_settings))
+ lm->bloom_filter_settings))
return true;
}
return false;
@@ -375,14 +377,6 @@ static int last_modified_run(struct last_modified *lm)
prepare_revision_walk(&lm->rev);
- /*
- * prepare_revision_walk() clears bloom_filter_settings for pathspecs
- * without a Bloom key. Restore it so the per-path check keeps working.
- */
- if (!lm->rev.bloom_filter_settings)
- lm->rev.bloom_filter_settings =
- get_bloom_filter_settings(lm->rev.repo);
-
max_count = lm->rev.max_count;
init_active_paths_for_commit(&lm->active_paths);
@@ -530,7 +524,7 @@ static int last_modified_init(struct last_modified *lm, struct repository *r,
return argc;
}
- lm->rev.bloom_filter_settings = get_bloom_filter_settings(lm->rev.repo);
+ lm->bloom_filter_settings = get_bloom_filter_settings(lm->rev.repo);
if (populate_paths_from_revs(lm) < 0)
return -1;
prev parent reply other threads:[~2026-09-10 7:04 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 15:46 [PATCH 0/4] last-modified: use the pathspec's Bloom key to pre-filter commits Toon Claes
2026-07-17 15:46 ` [PATCH 1/4] revision: move bloom keyvec precondition into function Toon Claes
2026-07-18 7:57 ` Jeff King
2026-08-05 19:16 ` Toon Claes
2026-08-05 20:32 ` Jeff King
2026-07-17 15:47 ` [PATCH 2/4] revision: expose check for paths maybe changed in Bloom filter Toon Claes
2026-07-17 20:47 ` Junio C Hamano
2026-07-17 23:26 ` Taylor Blau
2026-07-17 15:47 ` [PATCH 3/4] last-modified: check pathspec against Bloom filter first Toon Claes
2026-07-17 23:05 ` Taylor Blau
2026-07-18 8:37 ` Jeff King
2026-07-18 21:22 ` Taylor Blau
2026-07-20 9:42 ` Jeff King
2026-07-17 15:47 ` [PATCH 4/4] last-modified: keep per-path Bloom filters for wildcard pathspecs Toon Claes
2026-07-17 19:16 ` Toon Claes
2026-07-18 8:14 ` Jeff King
2026-08-04 22:19 ` Junio C Hamano
2026-08-05 0:43 ` Taylor Blau
2026-08-05 16:01 ` Junio C Hamano
2026-08-05 1:18 ` Jeff King
2026-07-17 23:18 ` Taylor Blau
2026-07-17 19:13 ` [PATCH 0/4] last-modified: use the pathspec's Bloom key to pre-filter commits Toon Claes
2026-08-07 18:26 ` [PATCH v2 0/6] " Toon Claes
2026-08-07 18:26 ` [PATCH v2 1/6] revision: move bloom keyvec precondition into function Toon Claes
2026-08-07 18:26 ` [PATCH v2 2/6] revision: expose check for paths maybe changed in Bloom filter Toon Claes
2026-08-07 18:26 ` [PATCH v2 3/6] bloom: add helper to check if any key in a vector is present Toon Claes
2026-08-07 18:26 ` [PATCH v2 4/6] revision: add Bloom check that includes parent directories Toon Claes
2026-08-07 18:26 ` [PATCH v2 5/6] last-modified: check pathspec against Bloom filter first Toon Claes
2026-08-07 18:26 ` [PATCH v2 6/6] last-modified: keep per-path Bloom filters for wildcard pathspecs Toon Claes
2026-08-08 17:07 ` Junio C Hamano
2026-08-31 15:18 ` [PATCH v3 0/6] last-modified: use the pathspec's Bloom key to pre-filter commits Toon Claes
2026-08-31 15:18 ` [PATCH v3 1/6] revision: move bloom keyvec precondition into function Toon Claes
2026-08-31 15:18 ` [PATCH v3 2/6] revision: expose check for paths maybe changed in Bloom filter Toon Claes
2026-08-31 15:18 ` [PATCH v3 3/6] bloom: add helper to check if any key in a vector is present Toon Claes
2026-08-31 15:18 ` [PATCH v3 4/6] revision: add Bloom check that includes parent directories Toon Claes
2026-08-31 15:18 ` [PATCH v3 5/6] last-modified: check pathspec against Bloom filter first Toon Claes
2026-08-31 15:18 ` [PATCH v3 6/6] last-modified: keep per-path Bloom filters for wildcard pathspecs Toon Claes
2026-09-01 4:19 ` Junio C Hamano
2026-09-01 9:14 ` Toon Claes
2026-09-01 13:47 ` Junio C Hamano
2026-08-31 21:19 ` [PATCH v3 0/6] last-modified: use the pathspec's Bloom key to pre-filter commits Junio C Hamano
2026-09-01 9:10 ` [PATCH v4 " Toon Claes
2026-09-01 9:10 ` [PATCH v4 1/6] revision: move bloom keyvec precondition into function Toon Claes
2026-09-01 9:10 ` [PATCH v4 2/6] revision: expose check for paths maybe changed in Bloom filter Toon Claes
2026-09-01 9:10 ` [PATCH v4 3/6] bloom: add helper to check if any key in a vector is present Toon Claes
2026-09-10 7:03 ` Patrick Steinhardt
2026-09-01 9:10 ` [PATCH v4 4/6] revision: add Bloom check that includes parent directories Toon Claes
2026-09-10 7:04 ` Patrick Steinhardt
2026-09-01 9:10 ` [PATCH v4 5/6] last-modified: check pathspec against Bloom filter first Toon Claes
2026-09-10 7:04 ` Patrick Steinhardt
2026-09-01 9:10 ` [PATCH v4 6/6] last-modified: keep per-path Bloom filters for wildcard pathspecs Toon Claes
2026-09-10 7:04 ` Patrick Steinhardt [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=aqJWihcFmX7tPio5@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gusted@codeberg.org \
--cc=me@ttaylorr.com \
--cc=peff@peff.net \
--cc=toon@iotcl.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.