From 2a2c2f3373f0a3e76546e7c44ec3afa96d5e6e6f Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Tue, 3 Nov 2015 11:24:02 -0800 Subject: [PATCH] Use 'reused' bitmap to filter walk during bitmap selection 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 --- .../storage/pack/PackWriterBitmapPreparer.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java index f14e8cc5d..4df54942a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java @@ -265,8 +265,8 @@ Collection selectCommits(int expectedCommitCount) 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 @@ private CommitSelectionHelper setupTipCommitBitmaps(RevWalk rw, } return new CommitSelectionHelper(peeledWant, commits, pos, - orderedTipCommitBitmaps, reuseCommits); + orderedTipCommitBitmaps, reuse, reuseCommits); } /*- @@ -565,6 +565,8 @@ BitmapBuilder getBuilder() { private static final class CommitSelectionHelper implements Iterable { final Set peeledWants; final List tipCommitBitmaps; + + final BitmapBuilder reusedCommitsBitmap; final Iterable reusedCommits; final RevCommit[] commitsByOldest; final int commitStartPos; @@ -572,11 +574,13 @@ private static final class CommitSelectionHelper implements Iterable CommitSelectionHelper(Set peeledWant, RevCommit[] commitsByOldest, int commitStartPos, List bitmapEntries, + BitmapBuilder reusedCommitsBitmap, Iterable reuse) { this.peeledWants = peeledWant; this.commitsByOldest = commitsByOldest; this.commitStartPos = commitStartPos; this.tipCommitBitmaps = bitmapEntries; + this.reusedCommitsBitmap = reusedCommitsBitmap; this.reusedCommits = reuse; }