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

[PATCH] pack-objects: emit base before delta.

From
Junio C Hamano <junkio@cox.net>
Date
Jul 1, 2005, 05:58 UTC
Message-ID
<7vbr5nxe38.fsf@assigned-by-dhcp.cox.net>

This micro-optimizes the order of objects in a pack. By emitting base objects before deltified ones, unpack-objects do not keep items on delta_list.

I think it is prudent to keep the add_delta_to_list() logic in unpack-objects, so this commit only changes the packing side.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 pack-objects.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
9be15981d7038f1d9d0b105f45760987584e60a6
diff --git a/pack-objects.c b/pack-objects.c
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -114,11 +114,13 @@ static unsigned long write_one(struct sh
 		 * if it is written already.
 		 */
 		return offset;
-	e->offset = offset;
-	offset += write_object(f, e);
-	/* if we are delitified, write out its base object. */
+
+	/* if we are delitified, write out its base objects first */
 	if (e->delta)
 		offset = write_one(f, e->delta, offset);
+
+	e->offset = offset;
+	offset += write_object(f, e);
 	return offset;
 }
 
------------
Next: Junio C Hamano
Message 1 of 4 in “pack-objects: emit base before delta.”
  1. pack-objects: emit base before delta.Junio C Hamano, Jul 1, 2005
  2. Junio C HamanoJul 1, 2005
  3. Linus TorvaldsJul 1, 2005
  4. Junio C HamanoJul 1, 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.