PackWriter: Don't include edges in progress meter
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>
This commit is contained in:
parent
cc5295c4b4
commit
37a10e3006
|
@ -129,8 +129,6 @@ void search(ProgressMonitor monitor, ObjectToPack[] toSearch, int off,
|
||||||
int cnt) throws IOException {
|
int cnt) throws IOException {
|
||||||
try {
|
try {
|
||||||
for (int end = off + cnt; off < end; off++) {
|
for (int end = off + cnt; off < end; off++) {
|
||||||
monitor.update(1);
|
|
||||||
|
|
||||||
res = window[resSlot];
|
res = window[resSlot];
|
||||||
if (0 < maxMemory) {
|
if (0 < maxMemory) {
|
||||||
clear(res);
|
clear(res);
|
||||||
|
@ -152,6 +150,7 @@ void search(ProgressMonitor monitor, ObjectToPack[] toSearch, int off,
|
||||||
} else {
|
} else {
|
||||||
// Search for a delta for the current window slot.
|
// Search for a delta for the current window slot.
|
||||||
//
|
//
|
||||||
|
monitor.update(1);
|
||||||
search();
|
search();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -539,6 +539,7 @@ private void searchForDeltas(ProgressMonitor monitor)
|
||||||
cnt = findObjectsNeedingDelta(list, cnt, Constants.OBJ_BLOB);
|
cnt = findObjectsNeedingDelta(list, cnt, Constants.OBJ_BLOB);
|
||||||
if (cnt == 0)
|
if (cnt == 0)
|
||||||
return;
|
return;
|
||||||
|
int nonEdgeCnt = cnt;
|
||||||
|
|
||||||
// Queue up any edge objects that we might delta against. We won't
|
// 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
|
// be sending these as we assume the other side has them, but we need
|
||||||
|
@ -636,12 +637,15 @@ public int compare(ObjectToPack a, ObjectToPack b) {
|
||||||
|
|
||||||
// Above we stored the objects we cannot delta onto the end.
|
// Above we stored the objects we cannot delta onto the end.
|
||||||
// Remove them from the list so we don't waste time on them.
|
// 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--;
|
cnt--;
|
||||||
|
}
|
||||||
if (cnt == 0)
|
if (cnt == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
monitor.beginTask(JGitText.get().compressingObjects, cnt);
|
monitor.beginTask(JGitText.get().compressingObjects, nonEdgeCnt);
|
||||||
searchForDeltas(monitor, list, cnt);
|
searchForDeltas(monitor, list, cnt);
|
||||||
monitor.endTask();
|
monitor.endTask();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue