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
This commit is contained in:
parent
b28091e450
commit
2a2c2f3373
|
@ -265,8 +265,8 @@ Collection<BitmapCommit> selectCommits(int expectedCommitCount)
|
||||||
for (AnyObjectId objectId : selectionHelper.reusedCommits) {
|
for (AnyObjectId objectId : selectionHelper.reusedCommits) {
|
||||||
rw.markUninteresting(rw.parseCommit(objectId));
|
rw.markUninteresting(rw.parseCommit(objectId));
|
||||||
}
|
}
|
||||||
rw.setRevFilter(
|
rw.setRevFilter(PackWriterBitmapWalker.newRevFilter(
|
||||||
PackWriterBitmapWalker.newRevFilter(null, fullBitmap));
|
selectionHelper.reusedCommitsBitmap, fullBitmap));
|
||||||
|
|
||||||
while (rw.next() != null) {
|
while (rw.next() != null) {
|
||||||
// The RevFilter adds the reachable commits from this
|
// The RevFilter adds the reachable commits from this
|
||||||
|
@ -464,7 +464,7 @@ private CommitSelectionHelper setupTipCommitBitmaps(RevWalk rw,
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CommitSelectionHelper(peeledWant, commits, pos,
|
return new CommitSelectionHelper(peeledWant, commits, pos,
|
||||||
orderedTipCommitBitmaps, reuseCommits);
|
orderedTipCommitBitmaps, reuse, reuseCommits);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
@ -565,6 +565,8 @@ BitmapBuilder getBuilder() {
|
||||||
private static final class CommitSelectionHelper implements Iterable<RevCommit> {
|
private static final class CommitSelectionHelper implements Iterable<RevCommit> {
|
||||||
final Set<? extends ObjectId> peeledWants;
|
final Set<? extends ObjectId> peeledWants;
|
||||||
final List<BitmapBuilderEntry> tipCommitBitmaps;
|
final List<BitmapBuilderEntry> tipCommitBitmaps;
|
||||||
|
|
||||||
|
final BitmapBuilder reusedCommitsBitmap;
|
||||||
final Iterable<BitmapCommit> reusedCommits;
|
final Iterable<BitmapCommit> reusedCommits;
|
||||||
final RevCommit[] commitsByOldest;
|
final RevCommit[] commitsByOldest;
|
||||||
final int commitStartPos;
|
final int commitStartPos;
|
||||||
|
@ -572,11 +574,13 @@ private static final class CommitSelectionHelper implements Iterable<RevCommit>
|
||||||
CommitSelectionHelper(Set<? extends ObjectId> peeledWant,
|
CommitSelectionHelper(Set<? extends ObjectId> peeledWant,
|
||||||
RevCommit[] commitsByOldest, int commitStartPos,
|
RevCommit[] commitsByOldest, int commitStartPos,
|
||||||
List<BitmapBuilderEntry> bitmapEntries,
|
List<BitmapBuilderEntry> bitmapEntries,
|
||||||
|
BitmapBuilder reusedCommitsBitmap,
|
||||||
Iterable<BitmapCommit> reuse) {
|
Iterable<BitmapCommit> reuse) {
|
||||||
this.peeledWants = peeledWant;
|
this.peeledWants = peeledWant;
|
||||||
this.commitsByOldest = commitsByOldest;
|
this.commitsByOldest = commitsByOldest;
|
||||||
this.commitStartPos = commitStartPos;
|
this.commitStartPos = commitStartPos;
|
||||||
this.tipCommitBitmaps = bitmapEntries;
|
this.tipCommitBitmaps = bitmapEntries;
|
||||||
|
this.reusedCommitsBitmap = reusedCommitsBitmap;
|
||||||
this.reusedCommits = reuse;
|
this.reusedCommits = reuse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue