geforkt von Mirrors/Paper
275173e538
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 0c5d8709 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends 255c4fdb SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot CraftBukkit Changes: b6b514b7e SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends fcff84de9 SPIGOT-7399: Revert null check in CraftMetaItem#safelyAdd 44a4b5649 SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot 676969d01 SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory
47 Zeilen
2.4 KiB
Diff
47 Zeilen
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Tue, 22 Sep 2020 01:49:19 -0700
|
|
Subject: [PATCH] Optimise non-flush packet sending
|
|
|
|
Places like entity tracking make heavy use of packet sending,
|
|
and internally netty will use some very expensive thread wakeup
|
|
calls when scheduling.
|
|
|
|
Thanks to various hacks in ProtocolLib as well as other
|
|
plugins, we cannot simply use a queue of packets to group
|
|
send on execute. We have to call execute for each packet.
|
|
|
|
Tux's suggestion here is exactly what was needed - tag
|
|
the Runnable indicating it should not make a wakeup call.
|
|
|
|
Big thanks to Tux for making this possible as I had given
|
|
up on this optimisation before he came along.
|
|
|
|
Locally this patch drops the entity tracker tick by a full 1.5x.
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
|
index 347e1da7b5b890c297863736e62a8c225b112db2..5237eb10ca12f786bba66f5db2a2553fa10ffe62 100644
|
|
--- a/src/main/java/net/minecraft/network/Connection.java
|
|
+++ b/src/main/java/net/minecraft/network/Connection.java
|
|
@@ -434,9 +434,19 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
|
if (this.channel.eventLoop().inEventLoop()) {
|
|
this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper
|
|
} else {
|
|
+ // Paper start - optimise packets that are not flushed
|
|
+ // note: since the type is not dynamic here, we need to actually copy the old executor code
|
|
+ // into two branches. On conflict, just re-copy - no changes were made inside the executor code.
|
|
+ if (!flush) {
|
|
+ io.netty.util.concurrent.AbstractEventExecutor.LazyRunnable run = () -> {
|
|
+ this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
|
+ };
|
|
+ this.channel.eventLoop().execute(run);
|
|
+ } else { // Paper end - optimise packets that are not flushed
|
|
this.channel.eventLoop().execute(() -> {
|
|
- this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper
|
|
+ this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter // Paper - diff on change
|
|
});
|
|
+ } // Paper
|
|
}
|
|
|
|
}
|