git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why do base objects appear behind the delta in packs?
@ 2006-08-29 13:42 Shawn Pearce
  2006-08-29 14:40 ` Nicolas Pitre
  2006-08-29 14:58 ` Jakub Narebski
  0 siblings, 2 replies; 9+ messages in thread
From: Shawn Pearce @ 2006-08-29 13:42 UTC (permalink / raw)
  To: git

Sorry but this really is a pretty stupid question on my part:

In builtin-pack-objects.c write_one(), why is the base object written
behind the first delta that depends on it (if it hasn't been written
already) rather than BEFORE the first delta that depends on it?

If the base always had to appear before any delta that uses it then
unpack-objects wouldn't need to cache a delta in memory waiting
for the base to get unpacked.

>From a data locality perspective putting the base object before
or after the delta shouldn't matter, as either way the delta
is useless without the base.  So placing the base immediately
before the delta should perform just as well as placing it after.
Either way the OS should have the base in cache by the time the
delta is being accessed.

In other words, why not apply this patch and make it a requirement
of the pack file format?


diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 46f524d..5dd97b9 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -341,11 +341,11 @@ 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 deltified, write out its base object. */
 	if (e->delta)
 		offset = write_one(f, e->delta, offset);
+	e->offset = offset;
+	offset += write_object(f, e);
 	return offset;
 }
 

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-08-29 19:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-29 13:42 Why do base objects appear behind the delta in packs? Shawn Pearce
2006-08-29 14:40 ` Nicolas Pitre
2006-08-29 14:58 ` Jakub Narebski
2006-08-29 16:27   ` Shawn Pearce
2006-08-29 17:34     ` Junio C Hamano
2006-08-29 17:44       ` Shawn Pearce
2006-08-29 18:16         ` Nicolas Pitre
2006-08-29 18:32           ` Shawn Pearce
2006-08-29 19:23             ` Jon Smirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).