Most palettes stay unused, do not pre-size them

This commit is contained in:
themode 2021-12-18 23:34:00 +01:00 committed by TheMode
parent 9a138d0749
commit ba8667a361

View File

@ -46,10 +46,9 @@ final class PaletteImpl implements Palette, Cloneable {
this.valuesPerLong = Long.SIZE / bitsPerEntry; this.valuesPerLong = Long.SIZE / bitsPerEntry;
this.hasPalette = bitsPerEntry <= maxBitsPerEntry; this.hasPalette = bitsPerEntry <= maxBitsPerEntry;
final int initialCapacity = maxPaletteSize(bitsPerEntry) / 4; this.paletteToValueList = new IntArrayList(1);
this.paletteToValueList = new IntArrayList(initialCapacity);
this.paletteToValueList.add(0); this.paletteToValueList.add(0);
this.valueToPaletteMap = new Int2IntOpenHashMap(initialCapacity); this.valueToPaletteMap = new Int2IntOpenHashMap(1);
this.valueToPaletteMap.put(0, 0); this.valueToPaletteMap.put(0, 0);
} }