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

[PATCH 8/8] fetch.c: Remove call to parse_object() from process()

From
Sergey Vlasov <vsu@altlinux.ru>
Date
Sep 21, 2005, 16:19 UTC
Message-ID
<20050921161909.C39C5E2FFC7@center4.mivlgu.local>
In-Reply-To
<20050921161829.GA20944@master.mivlgu.local>

The call to parse_object() in process() is not actually needed - if the object type is unknown, parse_object() will be called by loop(); if the type is known, the object will be parsed by the appropriate process_*() function.

After this change blobs which exist locally are no longer parsed, which gives about 2x CPU usage improvement; the downside is that there will be no warnings for existing corrupted blobs, but detecting such corruption is the job of git-fsck-objects, not the fetch programs. Newly fetched objects are still checked for corruption in http-fetch.c and ssh-fetch.c (local-fetch.c does not seem to do it, but the removed parse_object() call would not be reached for new objects anyway).

---
 fetch.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
b8a4d51743787be17f9572dce2eb2f4040ac241b
diff --git a/fetch.c b/fetch.c
--- a/fetch.c
+++ b/fetch.c
@@ -134,7 +134,6 @@ static int process(struct object *obj)
 	obj->flags |= SEEN;
 
 	if (has_sha1_file(obj->sha1)) {
-		parse_object(obj->sha1);
 		/* We already have it, so we should scan it now. */
 		obj->flags |= TO_SCAN;
 	} else {
Previous: Sergey VlasovNext: Daniel Barkalow
Message 11 of 12 in “fetch.c optimizations”
  1. 0/8 fetch.c optimizationsSergey Vlasov, Sep 21, 2005
  2. 1/8 fetch.c: Remove useless lookup_object_type() call in process()Sergey Vlasov, Sep 21, 2005
  3. Junio C HamanoSep 21, 2005
  4. Sergey VlasovSep 22, 2005
  5. 2/8 fetch.c: Make process() look at each object only onceSergey Vlasov, Sep 21, 2005
  6. 3/8 fetch.c: Remove redundant SCANNED flagSergey Vlasov, Sep 21, 2005
  7. 4/8 fetch.c: Remove redundant TO_FETCH flagSergey Vlasov, Sep 21, 2005
  8. 5/8 fetch.c: Remove some duplicated code in process()Sergey Vlasov, Sep 21, 2005
  9. 6/8 fetch.c: Remove redundant test of TO_SCAN in process()Sergey Vlasov, Sep 21, 2005
  10. 7/8 fetch.c: Clean up object flag definitionsSergey Vlasov, Sep 21, 2005
  11. 8/8 fetch.c: Remove call to parse_object() from process()Sergey Vlasov, Sep 21, 2005
  12. Daniel BarkalowSep 21, 2005

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.