]> source.dussan.org Git - jgit.git/commitdiff
PackWriter: Don't include edges in progress meter 83/2383/2
authorShawn O. Pearce <spearce@spearce.org>
Sun, 30 Jan 2011 22:41:50 +0000 (14:41 -0800)
committerChris Aniszczyk <caniszczyk@gmail.com>
Tue, 1 Feb 2011 14:55:43 +0000 (08:55 -0600)
When compressing objects, don't include the edges in the progress
meter.  These cost almost no CPU time as they are simply pushed into
and popped out of the delta search window.

Change-Id: I7ea19f0263e463c65da34a7e92718c6db1d4a131
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaWindow.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

index 6a71ad7dcf121304eaab8927e03b85ac65c7af1c..07dcd943ce8776747010307bf11fd383e01352a4 100644 (file)
@@ -129,8 +129,6 @@ class DeltaWindow {
                        int cnt) throws IOException {
                try {
                        for (int end = off + cnt; off < end; off++) {
-                               monitor.update(1);
-
                                res = window[resSlot];
                                if (0 < maxMemory) {
                                        clear(res);
@@ -152,6 +150,7 @@ class DeltaWindow {
                                } else {
                                        // Search for a delta for the current window slot.
                                        //
+                                       monitor.update(1);
                                        search();
                                }
                        }
index 17c5a12d40b0c629fa36e9703ce4ac0bcaea1f32..9a586683af935733f8db41d9ed72cd0b732a7804 100644 (file)
@@ -539,6 +539,7 @@ public class PackWriter {
                cnt = findObjectsNeedingDelta(list, cnt, Constants.OBJ_BLOB);
                if (cnt == 0)
                        return;
+               int nonEdgeCnt = cnt;
 
                // Queue up any edge objects that we might delta against.  We won't
                // be sending these as we assume the other side has them, but we need
@@ -636,12 +637,15 @@ public class PackWriter {
 
                // Above we stored the objects we cannot delta onto the end.
                // Remove them from the list so we don't waste time on them.
-               while (0 < cnt && list[cnt - 1].isDoNotDelta())
+               while (0 < cnt && list[cnt - 1].isDoNotDelta()) {
+                       if (!list[cnt - 1].isEdge())
+                               nonEdgeCnt--;
                        cnt--;
+               }
                if (cnt == 0)
                        return;
 
-               monitor.beginTask(JGitText.get().compressingObjects, cnt);
+               monitor.beginTask(JGitText.get().compressingObjects, nonEdgeCnt);
                searchForDeltas(monitor, list, cnt);
                monitor.endTask();
        }