mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-24 09:34:50 +00:00
#1205: shape cache needs less memory
This commit is contained in:
@@ -73,7 +73,7 @@ public class Helper {
|
||||
|
||||
public static String decompilationErrorAdd = null;
|
||||
|
||||
private static final Map<String, Area> shapeCache = new HashMap<>();
|
||||
private static final Map<BitSet, Area> shapeCache = new HashMap<>();
|
||||
|
||||
private static final String[] hexStringCache;
|
||||
|
||||
@@ -1180,9 +1180,8 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
String key = byteArrayToBase64String(bs.toByteArray());
|
||||
if (shapeCache.containsKey(key)) {
|
||||
return shapeCache.get(key);
|
||||
if (shapeCache.containsKey(bs)) {
|
||||
return shapeCache.get(bs);
|
||||
}
|
||||
|
||||
for (int x = 0; x < width; x++) {
|
||||
@@ -1210,7 +1209,7 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
shapeCache.put(key, area);
|
||||
shapeCache.put(bs, area);
|
||||
return area;
|
||||
}
|
||||
|
||||
@@ -1238,9 +1237,8 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
String key = byteArrayToBase64String(bs.toByteArray());
|
||||
if (shapeCache.containsKey(key)) {
|
||||
return shapeCache.get(key);
|
||||
if (shapeCache.containsKey(bs)) {
|
||||
return shapeCache.get(bs);
|
||||
}
|
||||
|
||||
BitSet bsArea = new BitSet(width * height);
|
||||
@@ -1321,7 +1319,7 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
shapeCache.put(key, area);
|
||||
shapeCache.put(bs, area);
|
||||
return area;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user