summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2012-11-18 08:45:54 -0600
committerTravis Watkins <amaranth@ubuntu.com>2012-11-18 09:16:50 -0600
commit1044c32a54800eb68cef941db3f0c7f4b2831ea8 (patch)
treeb597ec2eef10e36ed1bd6d7a18757edeb0713942 /src/main/java
parent028860399bd9440acc6dc7dd187c01c655d0e7b1 (diff)
downloadcraftbukkit-1044c32a54800eb68cef941db3f0c7f4b2831ea8.tar
craftbukkit-1044c32a54800eb68cef941db3f0c7f4b2831ea8.tar.gz
craftbukkit-1044c32a54800eb68cef941db3f0c7f4b2831ea8.tar.lz
craftbukkit-1044c32a54800eb68cef941db3f0c7f4b2831ea8.tar.xz
craftbukkit-1044c32a54800eb68cef941db3f0c7f4b2831ea8.zip
Lower compression level to avoid overloading the thread. Fixes BUKKIT-2963
When sending chunks to a player we use their writer thread to do chunk compression to avoid blocking the main thread with this work. However, after a teleport or respawn there are a large number of chunk packets to process. This causes the thread to spend a long period handling compression while we continue dumping more chunk packets on it to handle. The result of this is a noticable delay in getting responses to commands and chat immediately after teleporting. Switching to a lower compression level reduces this load and makes our behavior more like vanilla. We do, however, still give this thread more work to do so there will likely still be some delay when comparing to vanilla. The only way to avoid this would be to put chunk compression back on the main thread and give everyone on the server a poorer experience instead.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/net/minecraft/server/Packet56MapChunkBulk.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
index f5aaea66..07681a88 100644
--- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
@@ -22,7 +22,8 @@ public class Packet56MapChunkBulk extends Packet {
static final ThreadLocal<Deflater> localDeflater = new ThreadLocal<Deflater>() {
@Override
protected Deflater initialValue() {
- return new Deflater(Deflater.BEST_COMPRESSION);
+ // Don't use higher compression level, slows things down too much
+ return new Deflater(6);
}
};
// CraftBukkit end