Browse Source

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>
master
Yunjie Li 5 years ago
parent
commit
e250482c7a
  1. 10
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java

10
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java

@ -18,7 +18,6 @@ import org.eclipse.jgit.internal.storage.file.BasePackBitmapIndex.StoredBitmap;
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 class PackBitmapIndexRemapper extends PackBitmapIndex
private PackBitmapIndexRemapper(PackBitmapIndex newPackIndex) {
this.oldPackIndex = null;
this.newPackIndex = newPackIndex;
this.convertedBitmaps = null;
this.inflated = null;
this.prevToNewMapping = null;
}
@ -74,7 +71,6 @@ public class PackBitmapIndexRemapper extends PackBitmapIndex
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 class PackBitmapIndexRemapper extends PackBitmapIndex
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 class PackBitmapIndexRemapper extends PackBitmapIndex
inflated.set(prevToNewMapping[i.next()]);
bitmap = inflated.toEWAHCompressedBitmap();
bitmap.trim();
convertedBitmaps.add(
new StoredBitmap(objectId, bitmap, null, oldBitmap.getFlags()));
return bitmap;
}

Loading…
Cancel
Save