Large memory use reduction when PostProcessing history

This commit is contained in:
dordsor21
2021-01-05 15:03:47 +00:00
parent 7c174ee6b3
commit 89cc2f9d9f
10 changed files with 269 additions and 97 deletions

View File

@ -1,6 +0,0 @@
package com.boydti.fawe.beta;
public interface IChunkGetCopy {
char[] getNewSetArr(int layer);
}

View File

@ -5,7 +5,6 @@ import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IBatchProcessor;
import com.boydti.fawe.beta.IChunk;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkGetCopy;
import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.object.HistoryExtent;
import com.boydti.fawe.util.EditSessionBuilder;
@ -157,7 +156,6 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
addEntityCreate(tag);
}
}
boolean updateSet = get instanceof IChunkGetCopy;
for (int layer = 0; layer < 16; layer++) {
if (!set.hasSection(layer)) {
continue;
@ -168,11 +166,7 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
blocksGet = FaweCache.IMP.EMPTY_CHAR_4096;
}
char[] blocksSet = set.load(layer);
char[] newBlocksSet = null;
if (updateSet) {
newBlocksSet = ((IChunkGetCopy) get).getNewSetArr(layer);
}
;
int by = layer << 4;
for (int y = 0, index = 0; y < 16; y++) {
int yy = y + by;
@ -189,9 +183,6 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
if (combinedTo != 0) {
add(xx, yy, zz, combinedFrom, combinedTo);
}
if (updateSet) {
blocksSet[index] = newBlocksSet[index];
}
}
}
}