]> source.dussan.org Git - jgit.git/commitdiff
Use 'reused' bitmap to filter walk during bitmap selection 97/59597/4
authorJonathan Nieder <jrn@google.com>
Tue, 3 Nov 2015 19:24:02 +0000 (11:24 -0800)
committerJonathan Nieder <jrn@google.com>
Thu, 5 Nov 2015 20:27:28 +0000 (12:27 -0800)
When building fullBitmap in order to determine which ancestor chain to
add this commit to, we were excluding the ancestors of reusedCommits
using markUninteresting.  This use of markUninteresting is a bit
wasteful because we already have a bitmap indicating exactly which
commits should be excluded (which can save some walking).  Use it.

A separate commit will remove the now-redundant markUninteresting
call.

No behavior change intended (except for performance improvement).

Change-Id: I1112641852d72aa05c9a8bd08a552c70342ccedb

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java

index f14e8cc5d27182ce39c71b442678b03e1af92149..4df54942a77ac3a06e39b8e04cdaa23abe1a6b50 100644 (file)
@@ -265,8 +265,8 @@ class PackWriterBitmapPreparer {
                                for (AnyObjectId objectId : selectionHelper.reusedCommits) {
                                        rw.markUninteresting(rw.parseCommit(objectId));
                                }
-                               rw.setRevFilter(
-                                               PackWriterBitmapWalker.newRevFilter(null, fullBitmap));
+                               rw.setRevFilter(PackWriterBitmapWalker.newRevFilter(
+                                               selectionHelper.reusedCommitsBitmap, fullBitmap));
 
                                while (rw.next() != null) {
                                        // The RevFilter adds the reachable commits from this
@@ -464,7 +464,7 @@ class PackWriterBitmapPreparer {
                }
 
                return new CommitSelectionHelper(peeledWant, commits, pos,
-                               orderedTipCommitBitmaps, reuseCommits);
+                               orderedTipCommitBitmaps, reuse, reuseCommits);
        }
 
        /*-
@@ -565,6 +565,8 @@ class PackWriterBitmapPreparer {
        private static final class CommitSelectionHelper implements Iterable<RevCommit> {
                final Set<? extends ObjectId> peeledWants;
                final List<BitmapBuilderEntry> tipCommitBitmaps;
+
+               final BitmapBuilder reusedCommitsBitmap;
                final Iterable<BitmapCommit> reusedCommits;
                final RevCommit[] commitsByOldest;
                final int commitStartPos;
@@ -572,11 +574,13 @@ class PackWriterBitmapPreparer {
                CommitSelectionHelper(Set<? extends ObjectId> peeledWant,
                                RevCommit[] commitsByOldest, int commitStartPos,
                                List<BitmapBuilderEntry> bitmapEntries,
+                               BitmapBuilder reusedCommitsBitmap,
                                Iterable<BitmapCommit> reuse) {
                        this.peeledWants = peeledWant;
                        this.commitsByOldest = commitsByOldest;
                        this.commitStartPos = commitStartPos;
                        this.tipCommitBitmaps = bitmapEntries;
+                       this.reusedCommitsBitmap = reusedCommitsBitmap;
                        this.reusedCommits = reuse;
                }