mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 21:56:33 +01:00
Performance improvements + Fix packet sending
Async flush the changeset (sync flush for undo when needed) - Not any faster, but edits will feel significantly faster Fix incorrect bit mask for fixlighting packet sending
This commit is contained in:
parent
7c96547c68
commit
3306bd2cdc
@ -431,7 +431,7 @@ public class FaweAPI {
|
|||||||
NMSRelighter relighter = new NMSRelighter(nmsQueue);
|
NMSRelighter relighter = new NMSRelighter(nmsQueue);
|
||||||
for (int x = minX; x <= maxX; x++) {
|
for (int x = minX; x <= maxX; x++) {
|
||||||
for (int z = minZ; z <= maxZ; z ++) {
|
for (int z = minZ; z <= maxZ; z ++) {
|
||||||
relighter.addChunk(x, z, null, 65536);
|
relighter.addChunk(x, z, null, 65535);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ public class Settings extends Config {
|
|||||||
public static boolean COMBINE_STAGES = true;
|
public static boolean COMBINE_STAGES = true;
|
||||||
@Comment({
|
@Comment({
|
||||||
"Higher compression reduces the size of history at the expense of CPU",
|
"Higher compression reduces the size of history at the expense of CPU",
|
||||||
"0 = Uncompressed byte array",
|
"0 = Uncompressed byte array (fastest)",
|
||||||
"1 = 1 pass fast compressor (default)",
|
"1 = 1 pass fast compressor (default)",
|
||||||
"2 = 2 x fast",
|
"2 = 2 x fast",
|
||||||
"3 = 3 x fast",
|
"3 = 3 x fast",
|
||||||
@ -115,8 +115,8 @@ public class Settings extends Config {
|
|||||||
"6 = 1 x medium, 3 x fast",
|
"6 = 1 x medium, 3 x fast",
|
||||||
"7 = 1 x high, 1 x medium, 1 x fast",
|
"7 = 1 x high, 1 x medium, 1 x fast",
|
||||||
"8 = 1 x high, 1 x medium, 2 x fast",
|
"8 = 1 x high, 1 x medium, 2 x fast",
|
||||||
"9 = 1 x high, 1 x medium, 3 x fast",
|
"9 = 1 x high, 1 x medium, 3 x fast (best compression)",
|
||||||
"NOTE: If using disk, do some compression as smaller files save faster"
|
"NOTE: If using disk, do some compression (3+) as smaller files save faster"
|
||||||
})
|
})
|
||||||
public static int COMPRESSION_LEVEL = 1;
|
public static int COMPRESSION_LEVEL = 1;
|
||||||
@Comment({
|
@Comment({
|
||||||
|
@ -52,6 +52,18 @@ public abstract class FaweChangeSet implements ChangeSet {
|
|||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean flushAsync() {
|
||||||
|
waiting.incrementAndGet();
|
||||||
|
TaskManager.IMP.async(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
waiting.decrementAndGet();
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean flush() {
|
public boolean flush() {
|
||||||
try {
|
try {
|
||||||
while (waiting.get() > 0) {
|
while (waiting.get() > 0) {
|
||||||
|
@ -1182,7 +1182,12 @@ public class EditSession extends AbstractWorld implements HasFaweQueue {
|
|||||||
queue.flush();
|
queue.flush();
|
||||||
}
|
}
|
||||||
if (getChangeSet() != null) {
|
if (getChangeSet() != null) {
|
||||||
((FaweChangeSet) getChangeSet()).flush();
|
if (Settings.HISTORY.COMBINE_STAGES) {
|
||||||
|
((FaweChangeSet) getChangeSet()).flushAsync();
|
||||||
|
} else {
|
||||||
|
((FaweChangeSet) getChangeSet()).flush();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,7 +423,10 @@ public class LocalSession {
|
|||||||
|
|
||||||
private FaweChangeSet getChangeSet(Object o) {
|
private FaweChangeSet getChangeSet(Object o) {
|
||||||
if (o instanceof FaweChangeSet) {
|
if (o instanceof FaweChangeSet) {
|
||||||
return (FaweChangeSet) o;
|
FaweChangeSet cs = (FaweChangeSet) o;
|
||||||
|
MainUtil.stacktrace();
|
||||||
|
cs.flush();
|
||||||
|
return cs;
|
||||||
}
|
}
|
||||||
if (o instanceof Integer) {
|
if (o instanceof Integer) {
|
||||||
return new DiskStorageHistory(currentWorld, this.uuid, (Integer) o);
|
return new DiskStorageHistory(currentWorld, this.uuid, (Integer) o);
|
||||||
@ -466,8 +469,6 @@ public class LocalSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FaweChangeSet changeSet = (FaweChangeSet) editSession.getChangeSet();
|
FaweChangeSet changeSet = (FaweChangeSet) editSession.getChangeSet();
|
||||||
// Just in case
|
|
||||||
changeSet.flush();
|
|
||||||
historySize += MainUtil.getSize(changeSet);
|
historySize += MainUtil.getSize(changeSet);
|
||||||
if (append) {
|
if (append) {
|
||||||
history.add(changeSet);
|
history.add(changeSet);
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.extension.platform;
|
|||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.command.AnvilCommands;
|
import com.boydti.fawe.command.AnvilCommands;
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FawePlayer;
|
import com.boydti.fawe.object.FawePlayer;
|
||||||
import com.boydti.fawe.object.changeset.FaweStreamChangeSet;
|
import com.boydti.fawe.object.changeset.FaweStreamChangeSet;
|
||||||
import com.boydti.fawe.object.exception.FaweException;
|
import com.boydti.fawe.object.exception.FaweException;
|
||||||
@ -334,9 +335,11 @@ public final class CommandManager {
|
|||||||
final long time = System.currentTimeMillis() - start;
|
final long time = System.currentTimeMillis() - start;
|
||||||
if (time > 5 && hasSession) {
|
if (time > 5 && hasSession) {
|
||||||
BBC.ACTION_COMPLETE.send(finalActor, (time / 1000d));
|
BBC.ACTION_COMPLETE.send(finalActor, (time / 1000d));
|
||||||
ChangeSet fcs = editSession.getChangeSet();
|
if (!Settings.HISTORY.COMBINE_STAGES) { // If stages are combined, we don't know the size yet (async flush)
|
||||||
if (fcs != null && fcs instanceof FaweStreamChangeSet) {
|
ChangeSet fcs = editSession.getChangeSet();
|
||||||
MainUtil.sendCompressedMessage((FaweStreamChangeSet) fcs, fp);
|
if (fcs != null && fcs instanceof FaweStreamChangeSet) {
|
||||||
|
MainUtil.sendCompressedMessage((FaweStreamChangeSet) fcs, fp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user