]> source.dussan.org Git - jgit.git/commit
PackWriter: Sort commits by parse order to improve locality 29/2529/1
authorShawn O. Pearce <spearce@spearce.org>
Thu, 17 Feb 2011 01:41:35 +0000 (17:41 -0800)
committerShawn O. Pearce <spearce@spearce.org>
Fri, 18 Feb 2011 05:32:03 +0000 (21:32 -0800)
commit733780e8a158b7bc45b8b687ac353ecadc905a63
treefeac6e60225d963883af07cccedc999c7d0a1dbc
parent681739b1c82877424192ace581014ad09bc28acf
PackWriter: Sort commits by parse order to improve locality

RevWalk in JGit and the revision code in C Git both parse commits out
of the pack file in an order that differs from strict timestamp and
topological sorting.  Both implementations pop a commit from the head
of a date queue, and then immediately parse all of its parents in
order to insert those into the date queue at the proper positions as
determined by their committer timestamp field.  This implies that the
parents are parsed when their most recent child is popped from the
queue, and not where they are popped during traversal.

Hoisting a parent commit to be immediately behind its child improves
locality by making sure all parents of a merge are clustered together,
and thus can be paged into the parser by the pack file buffering
system (aka WindowCache in JGit) together.

Change-Id: I80f9e64cafa2e8f082776b43845edf23065386a2
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java