PackBitmapIndex: Remove convertedBitmaps in the Remapper

The convertedBitmaps serves for time-optimization purpose. But it's
actually not saving time much but using lots of memory. So remove the
field here to save memory.

Currently the remapper class is only used in the construction of the
bitmap index file. And during the preparation of the file, we're only
getting bitmaps from the remapper when finding objects accessible from
a commit, so bitmap associated with each commit will only be fetched once
and thus the convertedBitmaps would hardly be read, which means that it's
not saving time.

Change-Id: Ic942a8e485135fb177ec21d09282d08ca6646fdb
Signed-off-by: Yunjie Li <yunjieli@google.com>
This commit is contained in:
Yunjie Li 2020-04-23 15:11:14 -07:00
parent dcb0265436
commit e250482c7a
1 changed files with 0 additions and 10 deletions

View File

@ -18,7 +18,6 @@
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.BitmapIndex;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectIdOwnerMap;
import com.googlecode.javaewah.EWAHCompressedBitmap;
import com.googlecode.javaewah.IntIterator;
@ -34,7 +33,6 @@ public class PackBitmapIndexRemapper extends PackBitmapIndex
private final BasePackBitmapIndex oldPackIndex;
final PackBitmapIndex newPackIndex;
private final ObjectIdOwnerMap<StoredBitmap> convertedBitmaps;
private final BitSet inflated;
private final int[] prevToNewMapping;
@ -65,7 +63,6 @@ public static PackBitmapIndexRemapper newPackBitmapIndex(
private PackBitmapIndexRemapper(PackBitmapIndex newPackIndex) {
this.oldPackIndex = null;
this.newPackIndex = newPackIndex;
this.convertedBitmaps = null;
this.inflated = null;
this.prevToNewMapping = null;
}
@ -74,7 +71,6 @@ private PackBitmapIndexRemapper(
BasePackBitmapIndex oldPackIndex, PackBitmapIndex newPackIndex) {
this.oldPackIndex = oldPackIndex;
this.newPackIndex = newPackIndex;
convertedBitmaps = new ObjectIdOwnerMap<>();
inflated = new BitSet(newPackIndex.getObjectCount());
prevToNewMapping = new int[oldPackIndex.getObjectCount()];
@ -152,10 +148,6 @@ public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) {
if (bitmap != null || oldPackIndex == null)
return bitmap;
StoredBitmap stored = convertedBitmaps.get(objectId);
if (stored != null)
return stored.getBitmap();
StoredBitmap oldBitmap = oldPackIndex.getBitmaps().get(objectId);
if (oldBitmap == null)
return null;
@ -168,8 +160,6 @@ public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) {
inflated.set(prevToNewMapping[i.next()]);
bitmap = inflated.toEWAHCompressedBitmap();
bitmap.trim();
convertedBitmaps.add(
new StoredBitmap(objectId, bitmap, null, oldBitmap.getFlags()));
return bitmap;
}