git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 2/2] packfile: skip hash checks in add_promisor_object()

From
Aaron Plattner <aplattner@nvidia.com>
Date
Dec 9, 2025, 01:48 UTC
Message-ID
<20251209014900.402637-3-aplattner@nvidia.com>
In-Reply-To
<20251209014900.402637-1-aplattner@nvidia.com>

When is_promisor_object() is called for the first time, it lazily initializes a set of all promisor objects by iterating through all objects in promisor packs. For each object, add_promisor_object() calls parse_object(), which decompresses and hashes the entire object.

For repositories with large pack files, this can take an extremely long time. For example, on a production repository with a 176 GB promisor pack:

 $ time ~/git/git/git-rev-list --objects --all --exclude-promisor-objects --quiet
 ________________________________________________________
 Executed in   76.10 mins    fish           external
    usr time   72.10 mins    1.83 millis   72.10 mins
    sys time    3.56 mins    0.17 millis    3.56 mins

add_promisor_object() just wants to construct the set of all promisor objects, so it doesn't really need to verify the hash of every object. Set PARSE_OBJECT_SKIP_HASH_CHECK to skip the hash check. This has the side effect of skipping decompression of blob objects completely, saving a significant amount of time:

 $ time ~/git/git/git-rev-list --objects --all --exclude-promisor-objects --quiet
 ________________________________________________________
 Executed in  124.70 secs    fish           external
    usr time   46.94 secs    0.00 millis   46.94 secs
    sys time   43.11 secs    1.03 millis   43.11 secs
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
---
 packfile.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/packfile.c b/packfile.c
index 3d8b994a61..d3014b6746 100644
--- a/packfile.c
+++ b/packfile.c
@@ -2295,7 +2295,8 @@ static int add_promisor_object(const struct object_id *oid,
 		we_parsed_object = 0;
 	} else {
 		we_parsed_object = 1;
-		obj = parse_object(pack->repo, oid);
+		obj = parse_object_with_flags(pack->repo, oid,
+					      PARSE_OBJECT_SKIP_HASH_CHECK);
 	}
 
 	if (!obj)
-- 
2.52.0
Previous: Aaron Plattner
Message 3 of 3 in “improve --exclude-promisor-objects performance”
  1. 0/2 improve --exclude-promisor-objects performanceAaron Plattner, Dec 9, 2025
  2. 1/2 object: apply skip_hash and discard_tree optimizations to unknown blobs tooAaron Plattner, Dec 9, 2025
  3. 2/2 packfile: skip hash checks in add_promisor_object()Aaron Plattner, Dec 9, 2025

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.