git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 17:00 UTC

[PATCH v3 1/6] revision: move bloom keyvec precondition into function

From
Toon Claes <toon@iotcl.com>
Date
Aug 31, 2026, 15:18 UTC
Message-ID
<20260831-toon-speed-up-last-modified-v3-1-2bbb864acf93@iotcl.com>
In-Reply-To
<20260831-toon-speed-up-last-modified-v3-0-2bbb864acf93@iotcl.com>

There are currently two callsites calling check_maybe_different_in_bloom_filter(). They both check if revs->bloom_keyvecs_nr is not zero before they call that function.

Move bloom_keyvecs_nr precondition into check_maybe_different_in_bloom_filter() to simplify the code.

Note that this changes `bloom_ret` to become -1 when there are no Bloom key vectors, which results in `count_bloom_filter_false_positive` not being incremented. This is unobservable, as the Bloom statistics are only reported when key vectors were set up.

Signed-off-by: Toon Claes <toon@iotcl.com>
---
 revision.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/revision.c b/revision.c
index 50dc8b1991..6a6a1b6fa0 100644
--- a/revision.c
+++ b/revision.c
@@ -752,6 +752,9 @@ static int check_maybe_different_in_bloom_filter(struct rev_info *revs,
 	struct bloom_filter *filter;
 	int result = 0;
 
+	if (!revs->bloom_keyvecs_nr)
+		return -1;
+
 	if (commit_graph_generation(commit) == GENERATION_NUMBER_INFINITY)
 		return -1;
 
@@ -806,7 +809,7 @@ static int rev_compare_tree(struct rev_info *revs,
 			return REV_TREE_SAME;
 	}
 
-	if (revs->bloom_keyvecs_nr && !nth_parent) {
+	if (!nth_parent) {
 		bloom_ret = check_maybe_different_in_bloom_filter(revs, commit);
 
 		if (bloom_ret == 0)
@@ -833,7 +836,7 @@ static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit,
 	if (!t1)
 		return 0;
 
-	if (!nth_parent && revs->bloom_keyvecs_nr) {
+	if (!nth_parent) {
 		bloom_ret = check_maybe_different_in_bloom_filter(revs, commit);
 		if (!bloom_ret)
 			return 1;
-- 
2.55.0.679.g6767b8d81c
Next: Toon Claes
Message 1 of 22 in “revision: move bloom keyvec precondition into function”
  1. 1/6 revision: move bloom keyvec precondition into functionToon Claes, Aug 31, 2026
  2. 2/6 revision: expose check for paths maybe changed in Bloom filterToon Claes, Aug 31, 2026
  3. 0/6 last-modified: use the pathspec's Bloom key to pre-filter commitsToon Claes, Aug 31, 2026
  4. 3/6 bloom: add helper to check if any key in a vector is presentToon Claes, Aug 31, 2026
  5. 4/6 revision: add Bloom check that includes parent directoriesToon Claes, Aug 31, 2026
  6. 5/6 last-modified: check pathspec against Bloom filter firstToon Claes, Aug 31, 2026
  7. 6/6 last-modified: keep per-path Bloom filters for wildcard pathspecsToon Claes, Aug 31, 2026
  8. Junio C HamanoAug 31, 2026
  9. Junio C HamanoSep 1, 2026
  10. Toon ClaesSep 1, 2026
  11. 0/6 last-modified: use the pathspec's Bloom key to pre-filter commitsToon Claes, Sep 1, 2026
  12. 1/6 revision: move bloom keyvec precondition into functionToon Claes, Sep 1, 2026
  13. 2/6 revision: expose check for paths maybe changed in Bloom filterToon Claes, Sep 1, 2026
  14. 3/6 bloom: add helper to check if any key in a vector is presentToon Claes, Sep 1, 2026
  15. 4/6 revision: add Bloom check that includes parent directoriesToon Claes, Sep 1, 2026
  16. 5/6 last-modified: check pathspec against Bloom filter firstToon Claes, Sep 1, 2026
  17. 6/6 last-modified: keep per-path Bloom filters for wildcard pathspecsToon Claes, Sep 1, 2026
  18. Junio C HamanoSep 1, 2026
  19. Patrick SteinhardtSep 10, 2026
  20. Patrick SteinhardtSep 10, 2026
  21. Patrick SteinhardtSep 10, 2026
  22. Patrick SteinhardtSep 10, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.