]> source.dussan.org Git - jgit.git/commit
PackWriter: Do not delta compress already packed objects 19/2619/1
authorShawn O. Pearce <spearce@spearce.org>
Tue, 1 Mar 2011 17:28:11 +0000 (09:28 -0800)
committerShawn O. Pearce <spearce@spearce.org>
Tue, 1 Mar 2011 18:07:08 +0000 (10:07 -0800)
commit67b064fc9fa7418fab83957b4f4e4baf9c6e08be
tree29f5533386da9a50b51157d67c67c1a132fc76ad
parentbf1b970de1e49e1b94e56ff886078c92890ae228
PackWriter: Do not delta compress already packed objects

This is a tiny optimization to how delta search works.  Checking for
isReuseAsIs() avoids doing delta compression search on non-delta
objects already stored in packs within the repository.  Such objects
are not likely to be delta compressable, as they were already delta
searched when their containing pack was generated and they were
not delta compressed at that time.  Doing delta compression now is
unlikely to produce a different result, but would waste a lot of CPU.

The isReuseAsIs() flag is checked before isDoNotDelta() because it
is very common to reuse objects in the output pack.  Most objects
get reused, and only a handful have the isDoNotDelta() bit set.
Moving the check earlier allows the loop to more quickly skip
through objects that will never need to be considered.

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