Browse Source

PackWriter: Skip progress messages on fast operations

If the "Finding sources" phase will complete in <1 second with no
delta compression enabled, don't bother showing the progress meter for
this phase.  Small repositories on the local filesystem tend to rip
through this phase always subsecond and the ProgressMonitor display
can actually slow the operation down.

If delta compression is enabled, there are two phases that may run
very quickly. Set the timer to 500 milliseconds instead, reducing the
risk that the user has to wait longer than 1 second before any sort of
output from the packer occurs.

Change-Id: I58110f17e2a5ffa0134f9768b94804d16bbb8399
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-1.1
Shawn O. Pearce 13 years ago
parent
commit
68cc21b60d
  1. 16
      org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

16
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

@ -80,6 +80,7 @@ import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.StoredObjectRepresentationNotAvailableException; import org.eclipse.jgit.errors.StoredObjectRepresentationNotAvailableException;
import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.AsyncObjectSizeQueue; import org.eclipse.jgit.lib.AsyncObjectSizeQueue;
import org.eclipse.jgit.lib.BatchingProgressMonitor;
import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.NullProgressMonitor; import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
@ -640,10 +641,21 @@ public class PackWriter {
if (writeMonitor == null) if (writeMonitor == null)
writeMonitor = NullProgressMonitor.INSTANCE; writeMonitor = NullProgressMonitor.INSTANCE;
if (reuseSupport != null && ( boolean needSearchForReuse = reuseSupport != null && (
reuseDeltas reuseDeltas
|| config.isReuseObjects() || config.isReuseObjects()
|| !cachedPacks.isEmpty())) || !cachedPacks.isEmpty());
if (compressMonitor instanceof BatchingProgressMonitor) {
long delay = 1000;
if (needSearchForReuse && config.isDeltaCompress())
delay = 500;
((BatchingProgressMonitor) compressMonitor).setDelayStart(
delay,
TimeUnit.MILLISECONDS);
}
if (needSearchForReuse)
searchForReuse(compressMonitor); searchForReuse(compressMonitor);
if (config.isDeltaCompress()) if (config.isDeltaCompress())
searchForDeltas(compressMonitor); searchForDeltas(compressMonitor);

Loading…
Cancel
Save