From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: ishland Date: Sun, 20 Sep 2020 00:05:44 +0800 Subject: [PATCH] Improve task performance Replace ConcurrentLinkedQueue + LockSupport hack to reduce time consumption of addTask(R)V Co-authored-by: Mykyta Komarn diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java index 27db247aa40e0516302c74b9bf00c631a8607af5..6f14c97fcc36c0717f72443d620c2383e102ba0f 100644 --- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java @@ -13,9 +13,11 @@ public abstract class IAsyncTaskHandler implements Mailbox d = Queues.newConcurrentLinkedQueue(); + private final java.util.concurrent.BlockingDeque d = new java.util.concurrent.LinkedBlockingDeque<>(); // Yatopia - improve task performance private int e; + private R next = null; // Yatopia - improve task performance - temp storage for next object + protected IAsyncTaskHandler(String s) { this.b = s; } @@ -79,7 +81,7 @@ public abstract class IAsyncTaskHandler implements Mailbox implements Mailbox implements Mailbox